From 6ab6ec541ef9ad2402cb694f3499ae63eaf19c1d Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 6 Mar 2012 16:25:06 +0100 Subject: [PATCH] make sure superusers is admin is nobody is --- pandora/app/config.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandora/app/config.py b/pandora/app/config.py index 7623c1b6..206887a2 100644 --- a/pandora/app/config.py +++ b/pandora/app/config.py @@ -41,6 +41,11 @@ def load_config(): settings.CONFIG = config admin = len(settings.CONFIG['userLevels']) - 1 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) for u in User.objects.filter(profile__level=admin)]) settings.MANAGERS = settings.ADMINS