Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

newforms-admin: Fixed #5919. The admin add stage with inlines works a…

…gain.

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@6836 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e4910ce5b720a0535837327c5ee7a0255c819d56 1 parent 42bd0c6
@jkocherhans jkocherhans authored
Showing with 3 additions and 2 deletions.
  1. +3 −2 django/contrib/admin/options.py
View
5 django/contrib/admin/options.py
@@ -494,17 +494,18 @@ def add_view(self, request, form_url=''):
ModelForm = self.form_add(request)
inline_formsets = []
+ obj = self.model()
if request.method == 'POST':
form = ModelForm(request.POST, request.FILES)
for FormSet in self.formsets_add(request):
- inline_formset = FormSet(data=request.POST, files=request.FILES)
+ inline_formset = FormSet(obj, data=request.POST, files=request.FILES)
inline_formsets.append(inline_formset)
if all_valid(inline_formsets) and form.is_valid():
return self.save_add(request, model, form, inline_formsets, '../%s/')
else:
form = ModelForm(initial=request.GET)
for FormSet in self.formsets_add(request):
- inline_formset = FormSet()
+ inline_formset = FormSet(obj)
inline_formsets.append(inline_formset)
adminForm = AdminForm(form, list(self.fieldsets_add(request)), self.prepopulated_fields)
Please sign in to comment.
Something went wrong with that request. Please try again.