Ticket #17417: 17417__fixed_implementation.patch

File 17417__fixed_implementation.patch, 1.4 KB (added by Hiroki Kiyohara, 11 years ago)
  • django/contrib/admin/options.py

    diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
    index fd516cb..834107c 100644
    a b class ModelAdmin(BaseModelAdmin):  
    11901190        if obj is None:
    11911191            raise Http404(_('%(name)s object with primary key %(key)r does not exist.') % {'name': force_text(opts.verbose_name), 'key': escape(object_id)})
    11921192
    1193         if request.method == 'POST' and "_saveasnew" in request.POST:
    1194             return self.add_view(request, form_url=reverse('admin:%s_%s_add' %
    1195                                     (opts.app_label, opts.model_name),
    1196                                     current_app=self.admin_site.name))
    1197 
    11981193        ModelForm = self.get_form(request, obj)
    11991194        formsets = []
    12001195        inline_instances = self.get_inline_instances(request, obj)
    12011196        if request.method == 'POST':
    12021197            form = ModelForm(request.POST, request.FILES, instance=obj)
    12031198            if form.is_valid():
     1199                if "_saveasnew" in request.POST:
     1200                    return self.add_view(request, form_url=reverse('admin:%s_%s_add' %
     1201                                    (opts.app_label, opts.model_name),
     1202                                    current_app=self.admin_site.name))
     1203
    12041204                form_validated = True
    12051205                new_object = self.save_form(request, form, change=True)
    12061206            else:
Back to Top