make sure superusers is admin is nobody is
This commit is contained in:
parent
5a79659bb3
commit
6ab6ec541e
1 changed files with 5 additions and 0 deletions
|
@ -41,6 +41,11 @@ def load_config():
|
||||||
settings.CONFIG = config
|
settings.CONFIG = config
|
||||||
admin = len(settings.CONFIG['userLevels']) - 1
|
admin = len(settings.CONFIG['userLevels']) - 1
|
||||||
if not 'syncdb' in sys.argv and not 'sqldiff' in sys.argv:
|
if not 'syncdb' in sys.argv and not 'sqldiff' in sys.argv:
|
||||||
|
if User.objects.filter(profile__level=admin).count() == 0:
|
||||||
|
for u in User.objects.filter(is_superuser=True):
|
||||||
|
p = u.get_profile()
|
||||||
|
p.level = admin
|
||||||
|
p.save()
|
||||||
settings.ADMIN = tuple([(u.username, u.email)
|
settings.ADMIN = tuple([(u.username, u.email)
|
||||||
for u in User.objects.filter(profile__level=admin)])
|
for u in User.objects.filter(profile__level=admin)])
|
||||||
settings.MANAGERS = settings.ADMINS
|
settings.MANAGERS = settings.ADMINS
|
||||||
|
|
Loading…
Reference in a new issue