[Django] #28111: Allow skipping validations done in database for Model.full_clean()

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Django] #28111: Allow skipping validations done in database for Model.full_clean()

Django
#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 [hidden email].
To post to this group, send email to [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Django] #28111: Allow skipping validations done in database for Model.full_clean()

Django
#28111: Allow skipping validations done in database for Model.full_clean()
-------------------------------------+-------------------------------------
     Reporter:  holvianssi           |                    Owner:  nobody
         Type:  New feature          |                   Status:  new
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Tim Graham):

 I'm not sure how feasible this would be to implement. It seems like that
 flag would have to be passed all the way to `Field.clean()` and to the
 field's validators. It's difficult to know which validators are duplicated
 and which aren't, especially as behavior might vary across databases. Were
 you thinking of offering a patch?

--
Ticket URL: <https://code.djangoproject.com/ticket/28111#comment:1>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.f7dd5e51ed15e386fec4450835600510%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Django] #28111: Allow skipping validations done in database for Model.full_clean()

Django
In reply to this post by Django
#28111: Allow skipping validations done in database for Model.full_clean()
-------------------------------------+-------------------------------------
     Reporter:  holvianssi           |                    Owner:  nobody
         Type:  New feature          |                   Status:  closed
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  needsinfo
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

 * status:  new => closed
 * resolution:   => needsinfo


--
Ticket URL: <https://code.djangoproject.com/ticket/28111#comment:2>
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.fc2170751035b09fc6f8a4ef6088a533%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.
Loading...