Ticket #3817: admin_modify.2.diff

File admin_modify.2.diff, 2.0 KB (added by reza@…, 8 years ago)

backward-compatibility and view changes

  • django/contrib/admin/templatetags/admin_modify.py

     
    3838    opts = context['opts']
    3939    change = context['change']
    4040    is_popup = context['is_popup']
     41    has_add_permission = context.has_key('has_add_permission') and context['has_add_permission'] or False
    4142    return {
    4243        'onclick_attrib': (opts.get_ordered_objects() and change
    4344                            and 'onclick="submitOrderForm();"' or ''),
    4445        'show_delete_link': (not is_popup and context['has_delete_permission']
    4546                              and (change or context['show_delete'])),
    4647        'show_save_as_new': not is_popup and change and opts.admin.save_as,
    47         'show_save_and_add_another': not is_popup and (not opts.admin.save_as or context['add']),
     48        'show_save_and_add_another': not is_popup and (not opts.admin.save_as or context['add']) and has_add_permission,
    4849        'show_save_and_continue': not is_popup and context['has_change_permission'],
    4950        'show_save': True
    5051    }
    5152submit_row = register.inclusion_tag('admin/submit_line.html', takes_context=True)(submit_row)
  • django/contrib/admin/views/main.py

     
    201201        'change': change,
    202202        'has_delete_permission': context['perms'][app_label][opts.get_delete_permission()],
    203203        'has_change_permission': context['perms'][app_label][opts.get_change_permission()],
     204        'has_add_permission': context['perms'][app_label][opts.get_add_permission()],
    204205        'has_file_field': opts.has_field_type(models.FileField),
    205206        'has_absolute_url': hasattr(model, 'get_absolute_url'),
    206207        'auto_populated_fields': auto_populated_fields,
Back to Top