Django Extend User Model with One-to-One Field

Adi Ramadhan
2 min readSep 20, 2020

Add custom user field that related to User Model.

Photo by Florian Olivo on Unsplash

Step 1: Preparation, Create Django Project, Initial Migration
create virtualenv: virtualenv venv
start virtualenv: venv/Scripts/activate
install Django in virtualenv: pip install django==3.0
Create Django: django-admin startproject myproject
Go to myproject folder: cd myproject
Initial Migration: python migrate

Step 2: Create Django Apps
Create apps: python startapp myapp
Add myapp to INSTALLED_APPS in myproject/

Step 3: Add Profile Class in myapp/
Add Profile class that extend built-in User Model


Step 4: Makemigrations and Migrate
Make migrations: python makemigrations
Migrate: python migrate

Step 5: Add Profile in Admin Site
Update myapp/
This is for testing purpose in django admin site


Step 6: Testing in Django Admin Site
Create super user: python createsuperuser

Try to access:

Try to login in Django admin with superuser

Try to update user profiles in Profiles menu

Important Note: Rendering in HTML
For further development, we can use this html code to show user and its profile in one HTML page.