Custom Field User Model

To add extra fields to the default Django User model, you can create a new model that inherits from the built-in User model and adds the extra fields you need. Here's an example:

Model

from django.contrib.auth.models import AbstractUser
from django.db import models

class CustomUser(AbstractUser):
    # Add extra fields here
    phone_number = models.CharField(max_length=20)
    address = models.CharField(max_length=200)

Settings.py

AUTH_USER_MODEL = 'your_app.CustomUser'

Make Migrations And Migrate

python manage.py makemigrations
python manage.py migrate

Forms

Views

Urls

Template

school/profile.html

Last updated