Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏫 Authentication & CRUD System — EduAdmin

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


📌 About The Project

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.


✨ Features

  • 🔐 User Registration & Login with Role Selection (Student / Teacher)
  • 🛡️ Protected Routes using @login_required decorator
  • 📊 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

🛠️ Tech Stack

Technology Usage
Python 3.x Backend language
Django 6.x Web framework
Pillow Image processing
SQLite Database
HTML & CSS (Tailwind) Frontend
Render Deployment platform

📂 Project Structure

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

🗄️ Models

UserModel (AbstractUser)

Field Type Note
username CharField inherited
email CharField inherited
phone_number CharField custom
role CharField (choices) Student / Teacher

StudentModel

Field Type
name CharField
email CharField
department CharField
age IntegerField
image ImageField

TeacherModel

Field Type
name CharField
email CharField
subject CharField
salary IntegerField

CourseModel

Field Type
title CharField
code CharField
credit IntegerField

⚙️ Key ORM Operations Used

# 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 records

📝 Django ModelForm (forms.py)

from 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"}),
        }

🚀 Getting Started

Prerequisites

  • Python 3.x
  • pip

Installation

# 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 runserver

Open your browser: http://127.0.0.1:8000


🔗 URL Routes

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

🧠 What I Learned

  • Role-based Custom User Model using AbstractUser
  • Profile image upload and update using ImageField + req.FILES
  • Django ModelForm with is_valid(), save(), and instance= for edit
  • Protecting views with @login_required decorator
  • Dashboard statistics using aggregate(Sum()), .count(), .order_by()
  • Preventing duplicate records using .exists()
  • Deploying a Django project with media files on Render

🙋‍♂️ Author

Fahad Bin Siddique


📄 License

This project is open source and available under the MIT License.

About

A Django School Management System with Role-Based Authentication, Image Upload, ModelForms & full CRUD for Students, Teachers & Courses. Deployed on Render.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages