thank you. i will try it On Tue, Dec 17, 2019 at 4:48 AM dumbaclassics <dumbaclass...@gmail.com> wrote:
> I once encountered the same problem with a Custom User Model > > The solution that worked for me was putting under the is_staff = True > > It wouldnt log in even afte that then I added the following methods under > my User > > def has_perm(self, perm, obj=None): > return True > > > def has_module_perms(self, app_label): > return True > > > and these three decorator functions > > @property > def is_admin(self): > return self.admin > > > @property > def is_staff(self): > return self.staff > > > @property > def is_active(self): > return self.active > > > > Thus worked for me and you can always try out and see > > > Thanks > > > > Sent from my Samsung Galaxy smartphone. > -------- Original message -------- > From: Tafadzwa Marshal <marsha...@gmail.com> > Date: 2019/12/17 00:22 (GMT+02:00) > To: django-users@googlegroups.com > Subject: Re: User is not logging in admin panel > > 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 > <https://groups.google.com/d/msgid/django-users/CAFgO-6hUKDCcHqt9vZP645rAksuKjNhuPRyG3JPv1TQTQL948A%40mail.gmail.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/qvuph1k0hok2q6s6sf30h3ug.1576538293475%40email.android.com > <https://groups.google.com/d/msgid/django-users/qvuph1k0hok2q6s6sf30h3ug.1576538293475%40email.android.com?utm_medium=email&utm_source=footer> > . > -- <https://about.me/sagarninave?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=gmail_api&utm_content=thumb> sagar ninave about.me/sagarninave <https://about.me/sagarninave?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=gmail_api&utm_content=thumb> -- 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/CAA6pdZ_0o8qp_FOB5xjm07jPxkFxPQXZXY-Pu1x96hoJtQ2XJg%40mail.gmail.com.