0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Removed redundant model instantiation in contrib.admin; refs #11390.

This commit is contained in:
TomV 2015-03-22 20:32:46 +00:00 committed by Tim Graham
parent b4382b7055
commit a4a58811b9

View File

@ -1387,7 +1387,7 @@ class ModelAdmin(BaseModelAdmin):
if add:
initial = self.get_changeform_initial_data(request)
form = ModelForm(initial=initial)
formsets, inline_instances = self._create_formsets(request, self.model(), change=False)
formsets, inline_instances = self._create_formsets(request, form.instance, change=False)
else:
form = ModelForm(instance=obj)
formsets, inline_instances = self._create_formsets(request, obj, change=True)