Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding required email field to django when creating users with admin

When creating/adding a user with Django admin; how can this be customized?

For example, currently, the username and password are prompted for. However, I'd like to customize this to also have other required fields, such as 'email'?

The Django tutorial isn't clear on admin user auth customization?

like image 903
webcrew Avatar asked Dec 06 '22 09:12

webcrew


1 Answers

  1. Place this in your models.py.

    from django.contrib.auth.models import User
    User._meta.get_field('email').blank = False
    
  2. Run makemigrations.

  3. Run migrate.

See the documentation

like image 81
Reamon C. Sumapig Avatar answered May 26 '23 19:05

Reamon C. Sumapig