diff options
| author | Markus Amalthea Magnuson <markus.magnuson@gmail.com> | 2016-04-03 16:50:01 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-04-20 11:31:44 -0400 |
| commit | 08cd6a0e56bac04e322388e7059072ad98db303c (patch) | |
| tree | 615d175fcf55f2d1ebe02a5895aacb1104b7ec03 /django | |
| parent | cb65e62c84dd8f6b412151e81cf665975143d397 (diff) | |
Fixed #16327 -- Redirected "Save as new" to change view instead of the changelist.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/admin/options.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 9bc736ed4e..22209416d6 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -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 |
