benwilber/boltstream

Cannot create superuser

ling-postfix opened this issue · 3 comments

Not sure if I broke something, but i'm having issues registering users.

➜ boltstream git:(master) ✗ python3 manage.py createsuperuser
Username:
Error: This field cannot be blank.
Username: admin
CommandError: “admin” is not a valid UUID.
➜ boltstream git:(master) ✗

Is there something special missing?

That is because of the implementation of the custom User model. See this line https://github.com/benwilber/boltstream/blob/master/boltstream/models.py#L26, the createsuperuser command uses the User.objects.get_by_natural_key see https://github.com/django/django/blob/master/django/contrib/auth/management/commands/createsuperuser.py#L234

So the UUID is not set before running the command.

This is clearly a bug, it needs to be fixed. Alternatively, you can create the user with python manage.py shell

from django.contrib.auth import get_user_model
get_user_model().objects.create_superuser(username="admin", password="password")

That'll work for now!

Onto the next series of bugs? Happy to help.

@ling-postfix Thanks for reporting!

Creating a superuser via the Django CLI has been fixed now.

#8