Ticket #5681: patch5681-1.diff

File patch5681-1.diff, 1.1 KB (added by cornel, 6 years ago)
  • django/contrib/admin/options.py

     
    801801
    802802        if obj is None:
    803803            raise Http404(_('%(name)s object with primary key %(key)r does not exist.') % {'name': force_unicode(opts.verbose_name), 'key': escape(object_id)})
    804 
    805         if request.method == 'POST' and request.POST.has_key("_saveasnew"):
    806             return self.add_view(request, form_url='../../add/')
    807 
     804       
    808805        ModelForm = self.get_form(request, obj)
    809806        formsets = []
    810807        if request.method == 'POST':
     
    826823                formsets.append(formset)
    827824
    828825            if all_valid(formsets) and form_validated:
     826                if request.POST.has_key("_saveasnew"):
     827                    return self.add_view(request, form_url='../../add/')
    829828                self.save_model(request, new_object, form, change=True)
    830829                form.save_m2m()
    831830                for formset in formsets:
Back to Top