Tuesday, August 4, 2020

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

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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2a69ebc6-cf63-4e67-8178-973b29818ac7o%40googlegroups.com.

No comments:

Post a Comment