College Management System
Project Setup
- Create django project
CollegeManagementSystem
django-admin startproject CollegeManagementSystem
- Create django app
Student
python manage.py startapp Student
- Create
templates
directory in CollegeManagementSystem
project root directory
- Create
templates
directory in student
app root directory
- Add
Student
app in the CollegeManagementSystem/settings.py
- Add
templates
directory with project's base directory in CollegeManagementSystem/setting.py
- Initial project setup done
- Run the initial migration:
- Run the server to check everything is working.
python manage.py runserver
Creating the Student Model
- In
Student/models.py
create Student
model.
- Register
Student
model in Student/admin.py
.
- Make migrations to the database
python manage.py makemigrations
python manage.py migrate
- Create superuser to get admin access
python manage.py createsuperuser
Creating the Views and URL patterns
- In
Students/views/py
create view functions.
- Create url patterns for each view in
Student/urls.py
.
- Add
Student.urls
to projects urls.py
.
- Each URL endpoint works now, yet to implement CRUD.
First Read the Database
- Go to the admin site and create some students.
- Create
base.html
in project directory.
- Create
list.html
in Student/templates/student
directory.
Creating New Students
- Create a
forms.py
file in Student
app.
- Create Student form field in
create.html
.
- Create Student view function.
Update existing data
- Update
edit_student
function.
- Add
edit.html
in Student app.
Delete Student
- Update
delete_student
function.
- Add
delete.html
in Student app.