#35560 closed Bug (fixed)
Model.full_clean() errors with GeneratedField and UniqueConstraint or CheckConstraint
Description ¶
Calling full_clean()
on an unsaved model instance which has either a UniqueConstraint
or CheckConstraint
raises the error:
AttributeError: Cannot read a generated field from an unsaved model.
This is similar to #35127.
The PR which will be attached shortly contains 4 new failing tests:
model_fields.test_generatedfield.GeneratedFieldTests.test_full_clean_with_unique_constraint model_fields.test_generatedfield.GeneratedFieldTests.test_full_clean_with_check_constraint model_fields.test_generatedfield.VirtualGeneratedFieldTests.test_full_clean_with_unique_constraint model_fields.test_generatedfield.VirtualGeneratedFieldTests.test_full_clean_with_check_constraint
Change History (12)
comment:1 by , 9 months ago
Summary: | Model.full_clean() errors with when GeneratedField and UniqueConstraint or CheckConstraint are present → Model.full_clean() errors with GeneratedField and UniqueConstraint or CheckConstraint |
---|
comment:2 by , 9 months ago
Has patch: | set |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:3 by , 9 months ago
Patch needs improvement: | set |
---|
comment:4 by , 9 months ago
Cc: | added |
---|---|
Severity: | Normal → Release blocker |
Triage Stage: | Unreviewed → Accepted |
Hello Mark Gensler, thank you for this ticket report! And big thanks for the prompt PR.
comment:5 by , 8 months ago
Patch needs improvement: | unset |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Note:
See TracTickets
for help on using tickets.
I've assigned this to myself as I'm happy to work on it. Will leave the discussion to the PR.