User Profile

In our project we will manage the user data in the following ways:

When it comes to creating forms, views, and templates for user data, we will focus on the custom user model and disregard the default User model. By adding first_name, last_name, and any other desired fields to the custom model, you can provide a more streamlined and user-friendly experience. Meanwhile, AllAuth can handle all password and email management, with a simple link to reset the email as needed.




Create / Update CUSTOM USER MODEL

models.py

forms.py

views.py

Templates crete a new user_profile_create_update.html file:

urls.py




Allauth url mappings

Display email used with the AllAuth authentication: As the email can be different to the user email stored in the User model, you can use this code instead:




Display User Profile

views.py

urls.py

Template: create a new user_profile.html file:




USER MODEL

The approach in this project is to include the relevant User Model fields in the Custom Profile Model, but in case it is required here is how to edit the User Model.

It is possible to use Django signals and create/update a custom user model every time the user model is updated, but for our project purposes the better solution will be to simply create a new custom model and disregard the user model completely.

forms.py Create a custom form to remove all the fields which are irrelevant to users:

self.fields.pop('password', None) removes the password prompt from the form

views.py

Tempaltes: create a new user_account_update.html file:

urls.py