1
0
mirror of https://github.com/django/django.git synced 2024-12-22 00:55:44 +00:00

Removed unreachable code from ModelAdmin.response_change().

ModelAdmin.response_add() is always used when _saveasnew is set.
This commit is contained in:
Mariana 2023-10-17 04:49:55 +01:00 committed by GitHub
parent f6629ee2c9
commit 4a5048b036
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1513,25 +1513,6 @@ class ModelAdmin(BaseModelAdmin):
)
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:
msg = format_html(
_(