Michael Hall avatar Michael Hall committed 9791dfa

Fixes to creating extended permissions

Comments (0)

Files changed (2)


     for klass in app_models:
         ctype = ContentType.objects.get_for_model(klass)
         for codename, name in _get_all_permissions(klass):
-            p, created = Permission.objects.get_or_create(codename=codename, content_type__pk=ctype.id,
-                defaults={'name': name, 'content_type': ctype})
+            p, created = Permission.objects.get_or_create(codename=codename[:100], content_type__pk=ctype.id,
+                defaults={'name': name[:50], 'content_type': ctype})
             if created and verbosity >= 2:
                 print "Adding permission '%s'" % p


 @author: Michael Hall <mhall119@gmail.com>
 from django.core.management.base import NoArgsCommand, CommandError
-from extauth.management import create_model_permissions, create_page_permissions
+from extauth.management import create_model_permissions
 from django.contrib.auth.management import create_permissions
 from django.db.models import get_app, get_apps
 from django.conf import settings
             if verbosity >= 1:
                 print "Updating Permissions for %s" % app.__name__
-            if verbosity >= 1:
+            if verbosity >= 2:
                 print "Creating standard permissions"
             create_permissions(app, [], verbosity, **options)
-            if verbosity >= 1:
+            if verbosity >= 2:
                 print "Creating ExtAuth model permissions"
             create_model_permissions(app, [], verbosity, **options)
-            if verbosity >= 1:
-                print "Creating ExtAuth page permissions"
-            create_page_permissions(app, [], verbosity, **options)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.