#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
------------------------------+--------------------------------------
Comment (by Steven Mapes):
Replying to [comment:3 Mariusz Felisiak]:
> 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.
Ah yes I missed that entry in the release notes when I was checking.
Sorry about that
--
Ticket URL: <https://code.djangoproject.com/ticket/34084#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/01070183cc1288e7-c1b4e91e-6244-4b45-890e-1cc49047d439-000000%40eu-central-1.amazonses.com.