Skip to content

Commit

Permalink
Removed unreachable code from ModelAdmin.response_change().
Browse files Browse the repository at this point in the history
ModelAdmin.response_add() is always used when _saveasnew is set.
  • Loading branch information
marianaasilva authored Oct 17, 2023
1 parent f6629ee commit 4a5048b
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions django/contrib/admin/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -1513,25 +1513,6 @@ def response_change(self, request, obj):
)
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(
_(
Expand Down

0 comments on commit 4a5048b

Please sign in to comment.