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

Question:

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?

Asked By: Amol_G

||

Answers:

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"

Answered By: Mindru Ion

In Django, making a user model by yourself is not recommended because other 3rd party packages depend on the user models Django provided.

There are two ways you can follow.

Extending the existing User model

Using a custom user model when starting a project

Answered By: Hyunmin
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.