AshMGM
AshMGM

Reputation: 63

How to create a superuser in my own User Form?

I am creating my own form to register users, but how can I make possible to create superusers in it, and also I know django allows you, call user in the views like this:reques.user.username. I can only use that using django forms or I can also use that with my forms

I creating my own form because I don´t want the restriccion django password have, is there a way to change that, in oder to not create my own form

Upvotes: 0

Views: 1341

Answers (1)

Usman Maqbool
Usman Maqbool

Reputation: 3371

You can run command

python manage.py createsuperuser 

Other way is that while saving User data make

is_superuser = True

For password

you need to inherit from AbstractBaseUser and then override that password field and needed to update it's hash, don't know how you will manage that thing but different hash are available.

Docs for custom user

Upvotes: 1

Related Questions