1π
The problem is quite simple. The User is not being saved into the database. As you say, there must be some problem with the save method in your user model. Also, the save method has no bug that stops it but it is working fine as a piece of code except saving the object
So what happens is when you signup as a user, everything runs fine, but the user is not saved. After that it tries to call back the user and it returns anonymous user. Now when you call any attribute of the user, it will raise a similar error.
Check your save method.
0π
The issue here is that you migrated the auth models to the database then migrated your custom user as a second step.
You need to start with a clean database and migrate your custom user in the first migration command you issue to the database.
There is mention in the documentation that you should always create your custom user tables as the first step, otherwise django will get itself in a twist.
Warning
Changing AUTH_USER_MODEL has a big effect on your database structure. It changes the tables that are available, and it will affect the construction of foreign keys and many-to-many relationships. If you intend to set AUTH_USER_MODEL, you should set it before creating any migrations or running manage.py migrate for the first time.
Changing this setting after you have tables created is not supported by makemigrations and will result in you having to manually fix your schema, port your data from the old user table, and possibly manually reapply some migrations.
- [Answer]-Django templates β can you pass arguments to template tags *args style?
- [Answer]-Is it possible to preprocess a template to remove its `{% extends %}` tag?