In Django, how would you extend the User model to include additional fields?

  • a. Subclass the User model and add your fields to the subclass.
  • b. Modify the Django source code to include additional fields in the User model.
  • c. Create a separate model with a one-to-one relationship to the User model to store additional fields.
  • d. It's not possible to extend the User model in Django.
In Django, you can extend the User model by creating a separate model with a one-to-one relationship to the User model to store additional fields. This approach maintains the integrity of the User model. Options a and b are not recommended as they can lead to issues during migrations and upgrades. Option d is incorrect.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *