#33527: remove unnecessary code from patch before in ModelAdmin inlines save.
-------------------------------------+-------------------------------------
Reporter: Maxim | Owner: nobody
Danilov |
Type: | Status: new
Cleanup/optimization |
Component: | Version: 4.0
contrib.admin | Keywords: modeladmin,
Severity: Normal | inlinemodel
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
i see in Patch from https://code.djangoproject.com/ticket/33111
was added:
{{{
form = ModelForm(request.POST, request.FILES, instance=obj)
formsets, inline_instances = self._create_formsets(request, form.instance
if add else obj, change=not add)
}}}
it is all ok, but if we have:
{{{
form = ModelForm(request.POST, request.FILES, instance=obj)
}}}
this is superabundant:
{{{
form.instance if add else obj
}}}
i think, it should be:
{{{
form = ModelForm(request.POST, request.FILES, instance=obj)
formsets, inline_instances = self._create_formsets(request, form.instance,
change=not add)
# or # formsets, inline_instances = self._create_formsets(request, obj,
change=not add)
}}}
The same changes is possible to made in code-block for request.GET
--
Ticket URL: <https://code.djangoproject.com/ticket/33527>
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/052.0ed5357cb3131b1f0fca21b899dac3ad%40djangoproject.com.