#34084: ModelForms always set self.instance even when none passed in
------------------------------+--------------------------------------
     Reporter:  Steven Mapes  |                    Owner:  nobody
         Type:  Bug           |                   Status:  closed
    Component:  Forms         |                  Version:  4.1
     Severity:  Normal        |               Resolution:  invalid
     Keywords:  modelform     |             Triage Stage:  Unreviewed
    Has patch:  0             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  0
Easy pickings:  0             |                    UI/UX:  0
------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

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


Comment:

 Thanks for the report, however this behavior was intentionally changed in
 7ba6ebe9149ae38257d70100e8bfbfd0da189862 and it's documented in release
 notes. Previously an empty queryset was implicitly returned for unsaved
 instances now you need to protect your code and check `self.instance.pk`.

 There is no change in the `ModelForm` behavior, `self.instance` was always
 set.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34084#comment:3>
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/01070183caccf593-4e6544b9-b522-4a69-b66f-422d9163b130-000000%40eu-central-1.amazonses.com.

Reply via email to