try this code, do not forget import authenticate (from django.contrib.auth import authenticate, login) modify this code
On Wed, Mar 3, 2021 at 8:01 PM Kasper Laudrup <[email protected]> wrote: > On 03/03/2021 16.27, Devansh Soni wrote: > > Hi, > > > > I'm currently working on a Django project in which I have to create a > > User model with fields such as username, email, college, branch, > > semester, password, etc. And use this model to authenticate a user with > > an email and password. > > > > How can I achieve this? Or what are the ways to achieve this? > > > > https://docs.djangoproject.com/en/3.1/topics/auth/customizing/ > https://testdriven.io/blog/django-custom-user-model/ > > https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html > https://learndjango.com/tutorials/django-custom-user-model > > > There's tons of documentation and examples for doing that. > > Kind regards, > > Kasper Laudrup > > -- > 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/6206bd8c-dec4-1362-75a4-34d370e1d5ea%40stacktrace.dk > . > -- 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/CAJwZndfACQ0WWnBxOaWa1AfdMtKFD4vmRX3KHfoa1e6%2BYjWe8g%40mail.gmail.com.

