In my project I have two apps. Both of these apps require the *email* field
not to be blank and one of those apps doesn't need the *first_name* and the
*last_name* fields, so I decided to override the default *User* class
available from *django.contrib.auth.models*. I did it following this
<https://docs.djangoproject.com/en/3.0/topics/auth/customizing/#auth-custom-user>
guide.

Here you can find the models.py <https://dpaste.org/pZV9> file for the app
where my new User class is defined, as well as the settings.py
<https://dpaste.org/tS8R> code for my overall project (in the end of the
file I define *AUTH_USER_MODEL*). As the guide I linked in the above
paragraph suggests, I modified the admin.py <https://dpaste.org/QABt> file
as well.

I updated the models.py <https://dpaste.org/wwhp> file of my other app to
use the project-wide *AUTH_USER_MODEL* as well.

However, when I try to add a new user via the admin interface, I get an
error saying *FieldError at /admin/employers/user/8/change/ Unknown
field(s) (first_name, last_name) specified for User. Check
fields/fieldsets/exclude attributes of class UserAdmin*. Here's the
traceback: https://dpaste.org/osxj

I'm not sure what is going wrong here. I followed the guide here
<https://docs.djangoproject.com/en/3.0/topics/auth/customizing/> in its
entirety (you can see that from my admin.py file), but I still get the
error. *What is going on here? How do I fix this error?*

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CADvhLOQTMHkCu%2BSkousQmfMgypSAHwJ_%3DcVd9D3JzTwTDBHL%2Bw%40mail.gmail.com.

Reply via email to