magic-removal: Simplified code in admin.templatetags.admin_modify.submit_row

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2081 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-01-21 04:01:00 +00:00
parent 6ce5f51c55
commit 39fec03db6
1 changed files with 3 additions and 6 deletions

View File

@ -24,17 +24,14 @@ include_admin_script = register.simple_tag(include_admin_script)
def submit_row(context, bound_manipulator): def submit_row(context, bound_manipulator):
change = context['change'] change = context['change']
add = context['add']
show_delete = context['show_delete']
has_delete_permission = context['has_delete_permission']
is_popup = context['is_popup'] is_popup = context['is_popup']
return { return {
'onclick_attrib': (bound_manipulator.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 context['has_delete_permission']
and (change or show_delete)), and (change or context['show_delete'])),
'show_save_as_new': not is_popup and change and bound_manipulator.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 bound_manipulator.save_as or add), 'show_save_and_add_another': not is_popup and (not bound_manipulator.save_as or context['add']),
'show_save_and_continue': not is_popup, 'show_save_and_continue': not is_popup,
'show_save': True 'show_save': True
} }