class Meta:
constraints = (
models.UniqueConstraint(
fields=('index'),
name='%(app_label)s_%(class)s_U1'),
)
}}}
If I have one model with values (0, "old") and then try to update existing
model to (1, "old") and simultaneously add (0, "new"), checks in
Model._perform_unique_checks fail, despite there will be no constraint
violation at the end of transaction.
--
Ticket URL: <https://code.djangoproject.com/ticket/32370>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by Simon Charette):
Does the problem manifests itself if you use define your unique constraint
using `index = models.PositiveIntegerField(unique=True)` instead of
relying on `Meta.constraints`?
--
Ticket URL: <https://code.djangoproject.com/ticket/32370#comment:1>
Comment (by Tim Graham):
#25139 might be related or a duplicate.
--
Ticket URL: <https://code.djangoproject.com/ticket/32370#comment:2>
* status: new => closed
* resolution: => duplicate
Comment:
yeah that was my thought as well, I'll close for now as it seems like just
another flavor of #25139 using a new API.
--
Ticket URL: <https://code.djangoproject.com/ticket/32370#comment:3>