Fix permissions error

This commit is contained in:
arthur 2016-05-20 09:19:41 +02:00
parent fdd938b1ac
commit fdc5563cba
2 changed files with 5 additions and 1 deletions

View file

@ -10,3 +10,5 @@ VERSION = __version__ # synonym
# Default datetime input and output formats
ISO_8601 = 'iso-8601'
default_app_config = "djadmin2.apps.Djadmin2Config"

View file

@ -20,6 +20,7 @@ from __future__ import division, absolute_import, unicode_literals
import logging
import re
from django.contrib.auth import get_permission_codename
from django.db.utils import DEFAULT_DB_ALIAS
from django.apps import apps
from django.core.exceptions import ValidationError
@ -400,8 +401,9 @@ def create_view_permissions(app_config, verbosity=2, interactive=True, using=DEF
# Force looking up the content types in the current database
# before creating foreign keys to them.
ctype = ContentType.objects.db_manager(using).get_for_model(klass)
ctypes.add(ctype)
perm = ('view_%s' % klass.object_name.lower(), u'Can view %s' % klass._meta.verbose_name_raw)
perm = (get_permission_codename('view', klass._meta), 'Can view %s' % (klass._meta.verbose_name_raw))
searched_perms.append((ctype, perm))
# Find all the Permissions that have a content_type for a model we're