Ticket #6629: options.diff

File options.diff, 1.0 KB (added by lowshoe, 7 years ago)

Patch for django/contrib/admin/options.py

  • options.py

     
    555555        ModelForm = self.form_change(request, obj)
    556556        inline_formsets = []
    557557        if request.method == 'POST':
    558             form = ModelForm(request.POST, request.FILES)
     558            form = ModelForm(request.POST, request.FILES, instance=obj)
    559559            for FormSet in self.formsets_change(request, obj):
    560560                inline_formset = FormSet(obj, request.POST, request.FILES)
    561561                inline_formsets.append(inline_formset)
     
    563563            if all_valid(inline_formsets) and form.is_valid():
    564564                return self.save_change(request, model, form, inline_formsets)
    565565        else:
    566             form = ModelForm()
     566            form = ModelForm(instance=obj)
    567567            for FormSet in self.formsets_change(request, obj):
    568568                inline_formset = FormSet(obj)
    569569                inline_formsets.append(inline_formset)
Back to Top