Search code examples
pythondjangodjango-modelsmodel

how to make models for user auth(use abstract user) for login and signup using django?


how to make models for user auth(use abstract user) for login and signup using Django?

I want to make login OTP based for ecommerse website.

from django.db import models

class User(models.Model):
    first_name = models.CharField(max_length=40)
    last_name = models.CharField(max_length=40)
    mobile = models.CharField(max_length=10)
    address = models.CharField(max_length=200)
    emailId = models.CharField(max_length=50)
    password = models.CharField(max_length=200)
   

I tr above code. What should I have to add above?


Solution

  • You should use AbstractUser if you want to inherit permissions settings and all functions that Django uses.

    In settings, you should also add AUTH_USER_MODEL = "your_module_name.User"