#28210: `<orm_object>._state.adding` behaviour and model inheritance
-------------------------------------+-------------------------------------
     Reporter:  Ivaylo Donchev       |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.11
  (models, ORM)                      |
     Severity:  Release blocker      |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Simon Charette):

 Tim, I think the reporter was referring to form validation generating a
 `form.errors` along the dict he provided.

 Unique field validation relies on the `_state.adding` flag to determine
 [https://github.com/django/django/blob/master/django/db/models/base.py#L1013
 whether or not it should run].

 An appropriate test in this case would be along the lines of

 {{{#!python
 child = Child.objects.create()
 self.assertFalse(child.parent_ptr._state.adding)
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28210#comment:7>
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/069.18c8955586d2e4756cc99a20f4bfd654%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to