Ticket #5926: admin_permissions.diff

File admin_permissions.diff, 825 bytes (added by oyvind, 17 years ago)

Fix for adding admin permissions only when a admin class is present

  • django/contrib/auth/management.py

    diff --git a/django/contrib/auth/management.py b/django/contrib/auth/management.py
    index 2b4cb8b..d0030b9 100644
    a b def _get_permission_codename(action, opts):  
    1212def _get_all_permissions(opts):
    1313    "Returns (codename, name) for all permissions in the given opts."
    1414    perms = []
    15     for action in ('add', 'change', 'delete'):
    16         perms.append((_get_permission_codename(action, opts), u'Can %s %s' % (action, opts.verbose_name_raw)))
     15    if opts.admin:
     16        for action in ('add', 'change', 'delete'):
     17            perms.append((_get_permission_codename(action, opts), u'Can %s %s' % (action, opts.verbose_name_raw)))
    1718    return perms + list(opts.permissions)
    1819
    1920def create_permissions(app, created_models, verbosity):
Back to Top