#35560: Model.full_clean() errors with when GeneratedField and UniqueConstraint 
or
CheckConstraint are present
-------------------------------------+-------------------------------------
               Reporter:  Mark       |          Owner:  nobody
  Gensler                            |
                   Type:  Bug        |         Status:  new
              Component:  Database   |        Version:  5.0
  layer (models, ORM)                |       Keywords:  generatedfield
               Severity:  Normal     |  uniqueconstraint checkconstraint
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 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
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35560>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701904fae2814-c304bc41-b64a-4a89-b00b-63a10cca6071-000000%40eu-central-1.amazonses.com.

Reply via email to