mirror of
https://github.com/django/django.git
synced 2025-07-05 02:09:13 +00:00
magic-removal: Fixed #1471 -- Changed manage.py installperms to work with apps without model classes. Thanks, Christopher Lenz
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2514 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e695567d10
commit
0d9ab72fea
@ -430,7 +430,7 @@ def syncdb():
|
||||
sys.stderr.write("Permissions will not be installed because it "\
|
||||
"appears that you are not using Django's auth framework. "\
|
||||
"If you want to install them in the future, re-run syncdb."\
|
||||
"\n(The full error was: %s)" % e)
|
||||
"\n(The full error was: %s)\n" % e)
|
||||
transaction.rollback_unless_managed()
|
||||
else:
|
||||
transaction.commit_unless_managed()
|
||||
@ -563,9 +563,11 @@ def installperms(app):
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.auth.models import Permission
|
||||
from django.db.models import get_models
|
||||
num_added = 0
|
||||
app_models = get_models(app)
|
||||
if not app_models:
|
||||
return
|
||||
app_label = app_models[0]._meta.app_label
|
||||
num_added = 0
|
||||
for klass in app_models:
|
||||
opts = klass._meta
|
||||
ctype = ContentType.objects.get_for_model(klass)
|
||||
|
Loading…
x
Reference in New Issue
Block a user