1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #16327 -- Redirected "Save as new" to change view instead of the changelist.

This commit is contained in:
Markus Amalthea Magnuson
2016-04-03 16:50:01 +02:00
committed by Tim Graham
parent cb65e62c84
commit 08cd6a0e56
5 changed files with 48 additions and 2 deletions

View File

@@ -487,6 +487,7 @@ class ModelAdmin(BaseModelAdmin):
search_fields = ()
date_hierarchy = None
save_as = False
save_as_continue = True
save_on_top = False
paginator = Paginator
preserve_filters = True
@@ -1102,7 +1103,11 @@ class ModelAdmin(BaseModelAdmin):
'popup_response_data': popup_response_data,
})
elif "_continue" in request.POST:
elif "_continue" in request.POST or (
# Redirecting after "Save as new".
"_saveasnew" in request.POST and self.save_as_continue and
self.has_change_permission(request, obj)
):
msg = format_html(
_('The {name} "{obj}" was added successfully. You may edit it again below.'),
**msg_dict