#35575: Add support for constraint validation on GeneratedFields
-------------------------------------+-------------------------------------
     Reporter:  Mark Gensler         |                    Owner:  Mark
                                     |  Gensler
         Type:  New feature          |                   Status:  assigned
    Component:  Database layer       |                  Version:  5.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  generatedfield       |             Triage Stage:  Accepted
  uniqueconstraint checkconstraint   |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

 * cc: Mariusz Felisiak, Lily Foote, Simon Charette (added)
 * stage:  Unreviewed => Accepted
 * summary:
     Model.full_clean() does not recalculate GeneratedFields prior to
     validating model constraints
     => Add support for constraint validation on GeneratedFields
 * type:  Bug => New feature

Comment:

 Replying to [comment:1 Mark Gensler]:
 > Before writing any code to address this, I'd like to discuss ''where''
 best to apply the fix. I see two possible options:
 >
 > 1. Recalculate `GeneratedField` attribute values on the fly as part of
 calling `Constraint.validate()`. This will leave the instance attributes
 unchanged until `Model.save()` is called.
 > 2. Recalculate `GeneratedField` attributes on the model instance during
 `Model.full_clean()`, prior to calls to `Constraint.validate()`, and
 irrespective of whether relevant constraints are present.

 My gut says option 1
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35575#comment:4>
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/01070190796e103b-528debbc-8d32-43cf-b73c-4bdbc97dade6-000000%40eu-central-1.amazonses.com.

Reply via email to