Ticket #11105: 11beta1.diff

File 11beta1.diff, 1.1 KB (added by Henrique C. Alves, 16 years ago)
  • .py

    old new  
    44
    55from django.db.models import get_models, signals
    66from django.contrib.auth import models as auth_app
     7from django.utils.translation import ugettext as _
    78
    89def _get_permission_codename(action, opts):
    910    return u'%s_%s' % (action, opts.object_name.lower())
     
    1112def _get_all_permissions(opts):
    1213    "Returns (codename, name) for all permissions in the given opts."
    1314    perms = []
    14     for action in ('add', 'change', 'delete'):
    15         perms.append((_get_permission_codename(action, opts), u'Can %s %s' % (action, opts.verbose_name_raw)))
     15    default_actions = (
     16        ('add', _(u'Can add %(name)s') % {'name': opts.verbose_name_raw}),
     17        ('change', _(u'Can change %(name)s') % {'name': opts.verbose_name_raw}),
     18        ('delete', _(u'Can delete %(name)s') % {'name': opts.verbose_name_raw}),
     19    )
     20    for action, name in default_actions:
     21        perms.append((_get_permission_codename(action, opts), name))
    1622    return perms + list(opts.permissions)
    1723
    1824def create_permissions(app, created_models, verbosity, **kwargs):
Back to Top