IntegrityError - null value in column "email" violates not-null constraint

12 views
Skip to first unread message

Francisco André

unread,
Aug 4, 2020, 3:02:34 PM8/4/20
to Django users
Hey guys.

I'm developing a new project and creating a custom user model, extending the AbstractBaseUser class, but when add a new user in admin interface or modelform I get the error: IntegrityError at /null value in column "email" violates not-null constraint.

The field email is necessary and I inform in the form, it's used to login too.

It's necessary create a "custom modelform" too? I followed many  tutorials by web, including documentation. Links bellow.

https://docs.djangoproject.com/en/3.0/topics/auth/customizing/#custom-users-admin-full-example
https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html#abstractbaseuser

And, this my gist code of model, form and admin file.

https://gist.github.com/fandrefh/ff6d8bbe047654174aa699072589539a
Reply all
Reply to author
Forward
0 new messages