[Django] #34296: Formset validation does not consider models.UniqueConstraint

1 view
Skip to first unread message

Django

unread,
Jan 26, 2023, 12:22:15 PM1/26/23
to django-...@googlegroups.com
#34296: Formset validation does not consider models.UniqueConstraint
-------------------------------------+-------------------------------------
Reporter: Jannis | Owner: nobody
Vajen |
Type: Bug | Status: new
Component: Database | Version: 4.1
layer (models, ORM) | Keywords: formset,
Severity: Normal | constraints
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
When saving a formset with data that violates the model's
`UniqueConstraint()`, no form validation error is reported during
`formset.is_valid()`. Instead an IntegrityError is raised during
`formset.save()`. This only happens with the rather new
`UniqueConstraint()`, the older method of using `Meta.unique_together`
doesn't suffer from this.

--
Ticket URL: <https://code.djangoproject.com/ticket/34296>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 26, 2023, 12:22:50 PM1/26/23
to django-...@googlegroups.com
#34296: Formset validation does not consider models.UniqueConstraint
-------------------------------------+-------------------------------------
Reporter: Jannis Vajen | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 4.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: formset, | Triage Stage:
constraints | Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jannis Vajen):

* Attachment "unique_constraint.diff" added.

Test to reproduce the issue

Django

unread,
Jan 26, 2023, 12:23:45 PM1/26/23
to django-...@googlegroups.com
#34296: Formset validation does not consider models.UniqueConstraint
-------------------------------------+-------------------------------------
Reporter: Jannis Vajen | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: dev

(models, ORM) |
Severity: Normal | Resolution:
Keywords: formset, | Triage Stage:
constraints | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jannis Vajen):

* version: 4.1 => dev


--
Ticket URL: <https://code.djangoproject.com/ticket/34296#comment:1>

Reply all
Reply to author
Forward
0 new messages