mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Removed unreachable code from ModelAdmin.response_change().
ModelAdmin.response_add() is always used when _saveasnew is set.
This commit is contained in:
parent
f6629ee2c9
commit
4a5048b036
@ -1513,25 +1513,6 @@ class ModelAdmin(BaseModelAdmin):
|
|||||||
)
|
)
|
||||||
return HttpResponseRedirect(redirect_url)
|
return HttpResponseRedirect(redirect_url)
|
||||||
|
|
||||||
elif "_saveasnew" in request.POST:
|
|
||||||
msg = format_html(
|
|
||||||
_(
|
|
||||||
"The {name} “{obj}” was added successfully. You may edit it again "
|
|
||||||
"below."
|
|
||||||
),
|
|
||||||
**msg_dict,
|
|
||||||
)
|
|
||||||
self.message_user(request, msg, messages.SUCCESS)
|
|
||||||
redirect_url = reverse(
|
|
||||||
"admin:%s_%s_change" % (opts.app_label, opts.model_name),
|
|
||||||
args=(obj.pk,),
|
|
||||||
current_app=self.admin_site.name,
|
|
||||||
)
|
|
||||||
redirect_url = add_preserved_filters(
|
|
||||||
{"preserved_filters": preserved_filters, "opts": opts}, redirect_url
|
|
||||||
)
|
|
||||||
return HttpResponseRedirect(redirect_url)
|
|
||||||
|
|
||||||
elif "_addanother" in request.POST:
|
elif "_addanother" in request.POST:
|
||||||
msg = format_html(
|
msg = format_html(
|
||||||
_(
|
_(
|
||||||
|
Loading…
Reference in New Issue
Block a user