Commits

Florian Hahn committed b5aa002

use content type string in admin actions

  • Participants
  • Parent commits 55ed4e0

Comments (0)

Files changed (1)

File object_permission_backend_nonrel/admin.py

 from django.contrib.auth.models import User, Group, Permission
 from django.contrib.contenttypes.models import ContentType
 
-from .utils import grant_permissions
-from models import PermissionType, ObjectPermission, GroupObjectPermission
+from .utils import grant_permissions, get_content_type_string
+from .models import PermissionType, ObjectPermission, GroupObjectPermission
 
 
 def create_user_permission_obj(modeladmin, request, queryset):
     for obj in queryset:
-         ct = ContentType.objects.get_for_model(obj)
+         ct = get_content_type_string(obj)
          perm_obj = ObjectPermission.objects.create(content_type=ct,
                                                     object_id=obj.id)
 
 def create_group_permission_obj(modeladmin, request, queryset):
     for obj in queryset:
-         ct = ContentType.objects.get_for_model(obj)
+         ct = get_content_type_string.objects.get_for_model(obj)
          perm_obj = GroupObjectPermission.objects.create(content_type=ct,
                                                          object_id=obj.id)