mirror of
https://github.com/django/django.git
synced 2025-07-05 10:19:20 +00:00
Fixed save_as option
git-svn-id: http://code.djangoproject.com/svn/django/branches/new-admin@1081 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
741a13e1dd
commit
d545100ddb
@ -22,7 +22,7 @@
|
|||||||
{% endif %}{% endif %}
|
{% endif %}{% endif %}
|
||||||
<form {{ bound_manipulator.form_enc_attrib }} action='{{ form_url }}' method="post">{% block form_top %}{%endblock%}
|
<form {{ bound_manipulator.form_enc_attrib }} action='{{ form_url }}' method="post">{% block form_top %}{%endblock%}
|
||||||
{% if is_popup %}<input type="hidden" name="_popup" value="1">{% endif %}
|
{% if is_popup %}<input type="hidden" name="_popup" value="1">{% 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 %}
|
{% if form.error_dict %}
|
||||||
<p class="errornote">
|
<p class="errornote">
|
||||||
{% blocktrans count form.error_dict.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
|
{% 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 %}
|
{% for related_object in bound_manipulator.inline_related_objects %}{% edit_inline related_object %}{% endfor %}
|
||||||
{% block after_related_objects%}{%endblock%}
|
{% block after_related_objects%}{%endblock%}
|
||||||
{% submit_row %}
|
{% submit_row bound_manipulator %}
|
||||||
{% if add %}
|
{% if add %}
|
||||||
<script type="text/javascript">document.getElementById("{{bound_manipulator.first_form_field_id}}").focus();</script>
|
<script type="text/javascript">document.getElementById("{{bound_manipulator.first_form_field_id}}").focus();</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -24,22 +24,20 @@ include_admin_script = simple_tag(include_admin_script)
|
|||||||
|
|
||||||
|
|
||||||
#@inclusion_tag('admin/submit_line', takes_context=True)
|
#@inclusion_tag('admin/submit_line', takes_context=True)
|
||||||
def submit_row(context):
|
def submit_row(context, bound_manipulator):
|
||||||
change = context['change']
|
change = context['change']
|
||||||
add = context['add']
|
add = context['add']
|
||||||
show_delete = context['show_delete']
|
show_delete = context['show_delete']
|
||||||
ordered_objects = context['ordered_objects']
|
|
||||||
save_as = context['save_as']
|
|
||||||
has_delete_permission = context['has_delete_permission']
|
has_delete_permission = context['has_delete_permission']
|
||||||
is_popup = context['is_popup']
|
is_popup = context['is_popup']
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'onclick_attrib' : (ordered_objects and change
|
'onclick_attrib' : (bound_manipulator.ordered_objects and change
|
||||||
and 'onclick="submitOrderForm();"' or ''),
|
and 'onclick="submitOrderForm();"' or ''),
|
||||||
'show_delete_link' : (not is_popup and has_delete_permission
|
'show_delete_link' : (not is_popup and has_delete_permission
|
||||||
and (change or show_delete)),
|
and (change or show_delete)),
|
||||||
'show_save_as_new' : not is_popup and change and save_as,
|
'show_save_as_new' : not is_popup and change and bound_manipulator.save_as,
|
||||||
'show_save_and_add_another': not is_popup and (not save_as or add),
|
'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_and_continue': not is_popup,
|
||||||
'show_save': True
|
'show_save': True
|
||||||
}
|
}
|
||||||
|
@ -597,6 +597,7 @@ def add_stage(request, app_label, module_name, show_delete=False, form_url='', p
|
|||||||
'title': _('Add %s') % opts.verbose_name,
|
'title': _('Add %s') % opts.verbose_name,
|
||||||
'form': form,
|
'form': form,
|
||||||
'is_popup': request.REQUEST.has_key('_popup'),
|
'is_popup': request.REQUEST.has_key('_popup'),
|
||||||
|
'show_delete': show_delete,
|
||||||
})
|
})
|
||||||
if object_id_override is not None:
|
if object_id_override is not None:
|
||||||
c['object_id'] = object_id_override
|
c['object_id'] = object_id_override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user