Ticket #5650: skip_save_as_without_perm_r6442.patch

File skip_save_as_without_perm_r6442.patch, 1.7 KB (added by Silviu Julean <sjulean@…>, 17 years ago)

Initial patch against newforms-admin r6442

  • 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_add_permission']),
     33        'show_save_and_add_another': (not is_popup and (not save_as or context['add'])
     34                                        and context['has_add_permission']),
    3335        'show_save_and_continue': not is_popup and context['has_change_permission'],
    3436        'show_save': True
    3537    }
  • 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