#28111: Allow skipping validations done in database for Model.full_clean()
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
holvianssi |
Type: New | Status: new
feature |
Component: Database | Version: master
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
A common practice for Model.save() is to do something like:
{{{
def save():
self.full_clean()
super().save()
}}}
The idea is to validate for example field.choices, and other things that
aren't checked in database. Unfortunately this also checks unique
constraints, foreign keys etc, which is non-necessary in the common case -
the checks would be ran in the database in any case, and the db is much
faster in checking these constraints.
It would be nice that we could instead do something like this:
{{{
def save():
self.full_clean(skip_checks_done_in_database=True)
super().save()
}}}
This way we would have the additional safety of checking choices and other
things that aren't checked in the database, but we wouldn't have overhead
of checking a lot of constraints that are already checked in the database.
--
Ticket URL: <https://code.djangoproject.com/ticket/28111>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.8e4fe435bc891e127925e0b72f5711a7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.