hello, your problem is easy to solve. The 'createsuperuser' command creates a user with the 'staff' attribute set to true. When you create a user through the model thats inheriting from the User model, the default for the 'staff' attribute is set to false. The solution is to make sure you override the save method and set the 'staff' attribute to true.
On Mon, Dec 16, 2019 at 3:38 AM sagar ninave <sagarnin...@gmail.com> wrote: > Hello Everyone, > > i am getting some issue please help me. > > i have created custom user model in account app by extending auth user > model. also i have creates register api to register user. i am able to > create superuser from command prompt and api as well. and both user are > storing in single User model along with when i am hitting get request and i > got response all user which register from command prompt and api. problem > is that User is able to logging in admin panel which is registered by > command line by command *python manage.py createsuperuser *but user is > not able tologging in admin panel user which is created by register api. > when i am seeing data of both user created by cmd and created by register > api in admin panel that CMD created user's password is encrypted and user > created by register api is plain text. may be at the time of creating > superuser password is saving in encrypted form and user registered by api > his password is saving in plain text form so that it may not authenticating > user to redirect on admin panel. so what is happening exactly please clear > this doubt and help to get out from this situation > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/a962e5fd-c41d-465c-a179-14f84ace9551%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/a962e5fd-c41d-465c-a179-14f84ace9551%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFgO-6hUKDCcHqt9vZP645rAksuKjNhuPRyG3JPv1TQTQL948A%40mail.gmail.com.