Check request.user.is_superuser. If it return True, the role of the user signed in is Admin.
Saygılarımla, Sencer HAMARAT On Fri, Nov 29, 2019 at 3:41 PM Fruity Code <[email protected]> wrote: > I have an updated user model and added two fields to it, mobile_number and > role. The field role has two options Customer and Admin. Currently, I have > made customer as the default value for role. Now what I want is when user > signup the role should be a customer but when an admin create a user from > Django admin it's role should be Admin. > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/02a95589-3cae-4731-9a1a-66872d630e68%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/02a95589-3cae-4731-9a1a-66872d630e68%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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACp8TZgi%3D4nG%2BazKGK3JXBRBkD0XuhFuWsNzQWdRxJ9TcQgV5w%40mail.gmail.com.

