Ticket #3817: skip_save_as_without_perm_r6442.2.patch

File skip_save_as_without_perm_r6442.2.patch, 1.8 KB (added by Silviu Julean <sjulean@…>, 17 years ago)
  • contrib/admin/templatetags/admin_modify.py

     
    2828                            and 'onclick="submitOrderForm();"' or ''),
    2929        'show_delete_link': (not is_popup and context['has_delete_permission']
    3030                              and (change or context['show_delete'])),
    31         'show_save_as_new': not is_popup and change and save_as,
    32         'show_save_and_add_another': not is_popup and (not save_as or context['add']),
     31        'show_save_as_new': (not is_popup and change and save_as
     32                              and context.has_key('has_add_permission')
     33                              and context['has_add_permission']),
     34        'show_save_and_add_another': (not is_popup and (not save_as or context['add'])
     35                                        and context.has_key('has_add_permission')
     36                                        and context['has_add_permission']),
    3337        'show_save_and_continue': not is_popup and context['has_change_permission'],
    3438        'show_save': True
    3539    }
  • contrib/admin/views/main.py

     
    119119    extra_context = {
    120120        'add': add,
    121121        'change': change,
     122        'has_add_permission': context['perms'][app_label][opts.get_add_permission()],
    122123        'has_delete_permission': context['perms'][app_label][opts.get_delete_permission()],
    123124        'has_change_permission': context['perms'][app_label][opts.get_change_permission()],
    124125        'has_file_field': True, # FIXME - this should check if form or formsets have a FileField,
Back to Top