Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, it is possible to generate an AbstractUser instance within a model class located in the model.py file of Django. You can import the AbstractUser class from the django.contrib.auth.models module and then use it as a superclass for your custom model class. Your custom model class will inherit all the fields and methods defined in the AbstractUser class, which includes the username, password, and email fields, as well as methods for authentication and authorization.

However, it is recommended to use the AbstractUser class as a base class only for custom user models that require additional fields or methods. For a basic user model, you can use the built-in User model provided by Django instead of creating a new one.