A full-featured Django web application with Role-Based Authentication, Image Upload, Django ModelForms, and complete CRUD operations for a School Management System.
🌐 Live Demo: my-edu-admin.onrender.com 📁 Repository: fahadbinsiddique/Authentication-and-CRUD-System
This project was built to practice Django Authentication, ModelForms, File Uploads, and advanced ORM operations. It manages three core entities — Students, Teachers, and Courses — behind a secure login system with a live dashboard showing real-time statistics.
- 🔐 User Registration & Login with Role Selection (Student / Teacher)
- 🛡️ Protected Routes using
@login_requireddecorator - 📊 Dashboard with live stats — student count, teacher count, total salary
- 🖼️ Profile Image Upload & Update (ImageField + Pillow)
- 📋 Full CRUD — Students, Teachers, Courses
- 📝 Django ModelForm with custom widget styling
- 🔎 Duplicate email check before creating records
- 🎨 Responsive UI with Template Inheritance
| Technology | Usage |
|---|---|
| Python 3.x | Backend language |
| Django 6.x | Web framework |
| Pillow | Image processing |
| SQLite | Database |
| HTML & CSS (Tailwind) | Frontend |
| Render | Deployment platform |
Auth_Crud/
├── authCrudApp/
│ ├── migrations/
│ ├── templates/
│ │ ├── master/
│ │ │ ├── base.html
│ │ │ ├── nav.html
│ │ │ └── footer.html
│ │ ├── home.html
│ │ ├── register.html
│ │ ├── login.html
│ │ ├── dashboard.html
│ │ ├── student_list.html
│ │ ├── student_details.html
│ │ ├── add_student.html
│ │ ├── student_update.html
│ │ ├── teacher_list.html
│ │ ├── teacher_details.html
│ │ ├── add_teacher.html
│ │ ├── teacher_update.html
│ │ ├── course_list.html
│ │ ├── add_course.html
│ │ ├── edit_course.html
│ │ └── view_course.html
│ ├── admin.py
│ ├── forms.py
│ ├── models.py
│ ├── views.py
│ └── urls.py
├── Auth_Crud/
│ ├── settings.py
│ └── urls.py
├── media/
│ └── profile/
├── manage.py
└── requirements.txt
| Field | Type | Note |
|---|---|---|
| username | CharField | inherited |
| CharField | inherited | |
| phone_number | CharField | custom |
| role | CharField (choices) | Student / Teacher |
| Field | Type |
|---|---|
| name | CharField |
| CharField | |
| department | CharField |
| age | IntegerField |
| image | ImageField |
| Field | Type |
|---|---|
| name | CharField |
| CharField | |
| subject | CharField |
| salary | IntegerField |
| Field | Type |
|---|---|
| title | CharField |
| code | CharField |
| credit | IntegerField |
# Create
StudentModel.objects.create(name=name, email=email, ...)
UserModel.objects.create_user(username=username, password=password, role=role, ...)
# Read
StudentModel.objects.all()
StudentModel.objects.get(id=s_id)
# Update (via instance)
edit_student.name = req.POST.get("name")
edit_student.save()
# Delete
StudentModel.objects.get(id=s_id).delete()
# Filter & Check
StudentModel.objects.filter(email=email).exists() # duplicate check
# Aggregation & Stats
StudentModel.objects.count()
TeacherModel.objects.aggregate(total=Sum("salary"))["total"]
StudentModel.objects.order_by("-id")[:5] # recent 5 recordsfrom django import forms
from .models import CourseModel
class course_form(forms.ModelForm):
class Meta:
model = CourseModel
fields = '__all__'
widgets = {
"title": forms.TextInput(attrs={"placeholder": "Enter course title"}),
"code": forms.TextInput(attrs={"placeholder": "e.g. CSE101"}),
"credit": forms.NumberInput(attrs={"placeholder": "Enter credit"}),
}- Python 3.x
- pip
# 1. Clone the repository
git clone https://github.com/fahadbinsiddique/Authentication-and-CRUD-System.git
# 2. Navigate to project folder
cd Authentication-and-CRUD-System
# 3. Install dependencies
pip install -r requirements.txt
# 4. Run migrations
python manage.py migrate
# 5. Create superuser (optional)
python manage.py createsuperuser
# 6. Start the development server
python manage.py runserverOpen your browser: http://127.0.0.1:8000
| URL | Description | Protected |
|---|---|---|
/ |
Home Page | |
/register/ |
User Registration | |
/login/ |
Login | |
/logout/ |
Logout | |
/dashboard/ |
Dashboard with stats | ✅ |
/student-list/ |
All students | ✅ |
/add-student/ |
Add new student | ✅ |
/edit-student/<id>/ |
Update student | ✅ |
/student-details/<id>/ |
Student detail | ✅ |
/delete-student/<id>/ |
Delete student | ✅ |
/teacher-list/ |
All teachers | ✅ |
/add-teacher/ |
Add new teacher | ✅ |
/edit-teacher/<id>/ |
Update teacher | ✅ |
/teacher-details/<id>/ |
Teacher detail | ✅ |
/delete-teacher/<id>/ |
Delete teacher | ✅ |
/course-list/ |
All courses | ✅ |
/add-course/ |
Add new course | ✅ |
/course-edit/<id>/ |
Edit course | ✅ |
/course-view/<id>/ |
View course | ✅ |
/course-delete/<id>/ |
Delete course | ✅ |
- Role-based Custom User Model using
AbstractUser - Profile image upload and update using
ImageField+req.FILES - Django
ModelFormwithis_valid(),save(), andinstance=for edit - Protecting views with
@login_requireddecorator - Dashboard statistics using
aggregate(Sum()),.count(),.order_by() - Preventing duplicate records using
.exists() - Deploying a Django project with media files on Render
Fahad Bin Siddique
- GitHub: @fahadbinsiddique
- LinkedIn: https://www.linkedin.com/in/fahadbinsiddique/
This project is open source and available under the MIT License.