Ticket #11105: 11beta1.diff
File 11beta1.diff, 1.1 KB (added by , 16 years ago) |
---|
-
.py
old new 4 4 5 5 from django.db.models import get_models, signals 6 6 from django.contrib.auth import models as auth_app 7 from django.utils.translation import ugettext as _ 7 8 8 9 def _get_permission_codename(action, opts): 9 10 return u'%s_%s' % (action, opts.object_name.lower()) … … 11 12 def _get_all_permissions(opts): 12 13 "Returns (codename, name) for all permissions in the given opts." 13 14 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)) 16 22 return perms + list(opts.permissions) 17 23 18 24 def create_permissions(app, created_models, verbosity, **kwargs):