Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try:
- user = User.objects.get(username=username)
- except User.DoesNotExist:
- # Create a new user. Note that we can set password
- # to anything, because it won't be checked; the password
- # from settings.py will.
- user = User(username=username, password='get from settings.py')
- user.is_staff = True
- user.is_superuser = True
- user.save()
- return user
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement