diff --git a/django/contrib/admin/templates/admin/change_form.html b/django/contrib/admin/templates/admin/change_form.html index ac9e5279cc..b3992d3376 100644 --- a/django/contrib/admin/templates/admin/change_form.html +++ b/django/contrib/admin/templates/admin/change_form.html @@ -22,7 +22,7 @@ {% endif %}{% endif %}
{% block form_top %}{%endblock%} {% if is_popup %}{% endif %} -{% if bound_manipulator.save_on_top %}{% submit_row %}{% endif %} +{% if bound_manipulator.save_on_top %}{% submit_row bound_manipulator %}{% endif %} {% if form.error_dict %}

{% blocktrans count form.error_dict.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} @@ -52,7 +52,7 @@ {% for related_object in bound_manipulator.inline_related_objects %}{% edit_inline related_object %}{% endfor %} {% block after_related_objects%}{%endblock%} -{% submit_row %} +{% submit_row bound_manipulator %} {% if add %} {% endif %} diff --git a/django/contrib/admin/templatetags/admin_modify.py b/django/contrib/admin/templatetags/admin_modify.py index 88b21d3e12..1600804644 100644 --- a/django/contrib/admin/templatetags/admin_modify.py +++ b/django/contrib/admin/templatetags/admin_modify.py @@ -24,22 +24,20 @@ include_admin_script = simple_tag(include_admin_script) #@inclusion_tag('admin/submit_line', takes_context=True) -def submit_row(context): +def submit_row(context, bound_manipulator): change = context['change'] add = context['add'] show_delete = context['show_delete'] - ordered_objects = context['ordered_objects'] - save_as = context['save_as'] has_delete_permission = context['has_delete_permission'] is_popup = context['is_popup'] return { - 'onclick_attrib' : (ordered_objects and change + 'onclick_attrib' : (bound_manipulator.ordered_objects and change and 'onclick="submitOrderForm();"' or ''), 'show_delete_link' : (not is_popup and has_delete_permission and (change or show_delete)), - 'show_save_as_new' : not is_popup and change and save_as, - 'show_save_and_add_another': not is_popup and (not save_as or add), + 'show_save_as_new' : not is_popup and change and bound_manipulator.save_as, + 'show_save_and_add_another': not is_popup and (not bound_manipulator.save_as or add), 'show_save_and_continue': not is_popup, 'show_save': True } diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index cac0ec3150..7a53027db1 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -597,6 +597,7 @@ def add_stage(request, app_label, module_name, show_delete=False, form_url='', p 'title': _('Add %s') % opts.verbose_name, 'form': form, 'is_popup': request.REQUEST.has_key('_popup'), + 'show_delete': show_delete, }) if object_id_override is not None: c['object_id'] = object_id_override