📦 Learn how to create models and database tables in Django step by step!
In this video, we explain how to define a Django model, generate database tables using makemigrations and migrate, and register models in the Django admin panel.
📌 Topics covered in this video:
✅ What are Django models
✅ Creating models in models.py
✅ Using AutoField and CharField
✅ Creating custom table name using Meta class
✅ Running makemigrations and migrate commands
✅ Registering models in admin.py
✅ Registering Django app in INSTALLED_APPS
✅ Creating tables in PostgreSQL using Django ORM
This tutorial is perfect for Django beginners, students, and anyone learning Django with PostgreSQL.
👍 Like the video if it helped
💬 Comment if you face any issues
🔔 Subscribe for more Python & Django tutorials
🧩 Step-by-Step: Create Model and Table in Django
🔹 Step 1: Open models.py
Go to your app folder and open models.py
🔹 Step 2: Create Model
from django.db import models
class Employee(models.Model):
emp_id = models.AutoField(primary_key=True)
emp_name = models.CharField(max_length=200)
class Meta:
db_table = "Employee"
📌 This will create a database table named Employee
🔹 Step 3: Register App in settings.py
INSTALLED_APPS = [
'myapp',
]
🔹 Step 4: Run Migrations
python manage.py makemigrations
python manage.py migrate
OR for a specific app:
python manage.py makemigrations myapp
python manage.py migrate myapp
✅ Django will now create the Employee table in PostgreSQL.
🔐 Register Model in Admin Panel
🔹 Step 5: Open admin.py
from django.contrib import admin
from .models import Employee
admin.site.register(Employee)
django models tutorial
create table in django
django makemigrations migrate
django postgresql models
django admin register model
django database table creation
django orm tutorial
#Django
#Python
#DjangoModels
#PostgreSQL
#DjangoTutorial
#WebDevelopment
#BackendDevelopment
#Programming
#PythonDjango
#Database