Is there a way to change Django superuser name through cmd windows? If not, what is the other option(s)?
You can open the shell and user is_superuser to search for all the superusers through the console.
The common method to make the admin interface is to place all models in a single admin. Anyway, it is possible to have different admin pages in a single Django application.
When you say "name" it could be either first_name
, last_name
or the username
You can do this:
Open cmd, and navigate to the folder with manage.py
There
$ python manage.py shell
> from django.contrib.auth.models import User
> user = User.objects.get(username=<superuser's username>) #or email=<email>
> user.first_name = 'first_name'
> user.last_name = 'last_name'
> user.username = 'username' #make sure it is unique
> user.save()
Another option is to go to your database table auth_user
and change it there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With