Ticket #12224: ticket#1224.diff

File ticket#1224.diff, 1008 bytes (added by Felipe 'chronos' Prenholato, 15 years ago)

force_unicode fix for permissions

  • django/contrib/auth/management/__init__.py

     
    44
    55from django.db.models import get_models, signals
    66from django.contrib.auth import models as auth_app
     7from django.utils.encoding import force_unicode
    78
    89def _get_permission_codename(action, opts):
    910    return u'%s_%s' % (action, opts.object_name.lower())
     
    2526        ctype = ContentType.objects.get_for_model(klass)
    2627        for codename, name in _get_all_permissions(klass._meta):
    2728            p, created = Permission.objects.get_or_create(codename=codename, content_type__pk=ctype.id,
    28                 defaults={'name': name, 'content_type': ctype})
     29                defaults={'name': force_unicode(name), 'content_type': ctype})
    2930            if created and verbosity >= 2:
    3031                print "Adding permission '%s'" % p
    3132
Back to Top