Commit 1bb46723 authored by Florent Chehab's avatar Florent Chehab
Browse files

Admin access bug corrected

parent 10ef6018
...@@ -3,13 +3,21 @@ from django.contrib.auth.models import User ...@@ -3,13 +3,21 @@ from django.contrib.auth.models import User
class LoadAdminUser(object): class LoadAdminUser(object):
def __init__(self): def __init__(self):
self.admin = User.objects.get_or_create( """
Creating admin user by creating a user and setting is_staff is True
didn't enable access to the admin system for an unkown reason.
Need to use create_superuser.
"""
user = User.objects.filter(username="admin")
if len(user) > 0:
self.admin = user[0]
else:
User.objects.create_superuser(
username="admin", username="admin",
defaults={ email='null@null.fr',
'email': 'null@null.fr', password='admin',
'password': 'admin', )
'is_staff': True self.admin = User.objects.filter(username="admin")[0]
})[0]
def get(self): def get(self):
return self.admin return self.admin
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment