0% found this document useful (0 votes)
1 views8 pages

Django Python 3 4

The document outlines four Django CRUD assessment projects: an Employee Leave Management System, a Hospital Appointment Booking System, an Inventory Product Management System, and a Library Book Rental System. Each project requires the creation of specific web pages, models, CRUD operations, views, forms, and REST APIs, along with a common template structure and static files. The document also includes common commands, required packages, and evaluation criteria for assessing the projects.

Uploaded by

srikalaarege04
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views8 pages

Django Python 3 4

The document outlines four Django CRUD assessment projects: an Employee Leave Management System, a Hospital Appointment Booking System, an Inventory Product Management System, and a Library Book Rental System. Each project requires the creation of specific web pages, models, CRUD operations, views, forms, and REST APIs, along with a common template structure and static files. The document also includes common commands, required packages, and evaluation criteria for assessing the projects.

Uploaded by

srikalaarege04
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Django CRUD Assessment Projects

4 Project-Based Assessment Questions


1. Employee Leave Management System
Assessment Question: Build a Django application where employees can apply for leave and managers can manage leave
requests through web pages and APIs.

Web Pages to Create


1. Home page
2. Leave request list page
3. Leave request detail page
4. Create leave request page
5. Update leave request page
6. Delete confirmation page
Template rule: Create a common [Link] file and make every page extend it. The base template should include a
navbar, footer, static CSS link, static JS link, and a block content section.

Model Requirement: LeaveRequest


Field Name Suggested Type Notes / Choices
employee_name CharField Required
employee_email EmailField Required
leave_type CharField with choices Sick Leave, Casual Leave, Paid Leave,
Emergency Leave
start_date DateField Required
end_date DateField Required
reason TextField Required
status CharField with choices Pending, Approved, Rejected
created_at DateTimeField auto_now_add=True
updated_at DateTimeField auto_now=True

CRUD Requirements
1. Create a new leave request record.
2. View all leave request records.
3. View complete details of a single leave request record.
4. Update an existing leave request record.
5. Delete an existing leave request record using a confirmation page.

Views Requirement
Use function-based views for:
• Home page
• Leave request list page
• Leave request detail page
Use class-based views for:
• Create leave request using CreateView
• Update leave request using UpdateView
• Delete leave request using DeleteView
Recommended CBVs: CreateView, UpdateView, DeleteView

Django CRUD Assessment Projects | Templates, CBVs, Forms, DRF APIs, MySQL
Forms Requirement
Create a ModelForm named LeaveRequestForm. Use this form in both create and update operations.

Static Files Requirement (Optional)


static/
css/
[Link]
js/
[Link]
images/
• Style the navbar, forms, tables, cards, buttons, status labels, and delete confirmation page.

API Requirement Using Serializer and ModelViewSet


Create serializer: LeaveRequestSerializer using [Link].
Create ViewSet: LeaveRequestViewSet using ModelViewSet and register it with a DRF router.
Method Endpoint Purpose
GET /api/leaves/ Fetch all leave request records
POST /api/leaves/ Create a new leave request record
GET /api/leaves/<id>/ Fetch one leave request record
PUT /api/leaves/<id>/ Fully update one leave request record
PATCH /api/leaves/<id>/ Partially update one leave request record
DELETE /api/leaves/<id>/ Delete one leave request record

Generic Class-Based API View Requirement


Create generic API views using: ListCreateAPIView and RetrieveUpdateDestroyAPIView.
• LeaveRequestListCreateAPIView
• LeaveRequestDetailAPIView

Expected Output
• Working template-based CRUD pages.
• Function-based views and class-based views implemented correctly.
• ModelForm used for create and update pages.
• Static CSS and JS loaded correctly.
• MySQL connection configured and migrations completed.
• REST APIs working through serializer, ModelViewSet, and generic API views.
• Screenshots of web pages and API responses included in submission.

2. Hospital Appointment Booking System


Assessment Question: Build a Django application where patients can book hospital appointments and staff can manage
appointment records.

Web Pages to Create


1. Home page
2. Appointment list page
3. Appointment detail page
4. Book appointment page
5. Update appointment page
6. Delete appointment page

Django CRUD Assessment Projects | Templates, CBVs, Forms, DRF APIs, MySQL
Template rule: Create a common [Link] file and make every page extend it. The base template should include a
navbar, footer, static CSS link, static JS link, and a block content section.

Model Requirement: Appointment


Field Name Suggested Type Notes / Choices
patient_name CharField Required
patient_email EmailField Required
doctor_name CharField Required
department CharField with choices Cardiology, Dermatology, Orthopedics,
General Medicine, ENT
appointment_date DateField Required
appointment_time TimeField Required
symptoms TextField Optional or required as per design
status CharField with choices Booked, Completed, Cancelled
created_at DateTimeField auto_now_add=True
updated_at DateTimeField auto_now=True

CRUD Requirements
1. Create a new appointment record.
2. View all appointment records.
3. View complete details of a single appointment record.
4. Update an existing appointment record.
5. Delete an existing appointment record using a confirmation page.

Views Requirement
Use function-based views for:
• Home page
• Appointment list page
• Appointment detail page
Use class-based views for:
• Book appointment using CreateView
• Update appointment using UpdateView
• Delete appointment using DeleteView
Recommended CBVs: CreateView, UpdateView, DeleteView

Forms Requirement
Create a ModelForm named AppointmentForm. Use this form in both create and update operations.

Static Files Requirement (Optional)


static/
css/
[Link]
js/
[Link]
images/
• Style the navbar, forms, tables, cards, buttons, status labels, and delete confirmation page.

API Requirement Using Serializer and ModelViewSet


Create serializer: AppointmentSerializer using [Link].
Create ViewSet: AppointmentViewSet using ModelViewSet and register it with a DRF router.
Method Endpoint Purpose
GET /api/appointments/ Fetch all appointment records
Django CRUD Assessment Projects | Templates, CBVs, Forms, DRF APIs, MySQL
POST /api/appointments/ Create a new appointment record
GET /api/appointments/<id>/ Fetch one appointment record
PUT /api/appointments/<id>/ Fully update one appointment record
PATCH /api/appointments/<id>/ Partially update one appointment record
DELETE /api/appointments/<id>/ Delete one appointment record

Generic Class-Based API View Requirement


Create generic API views using: ListCreateAPIView and RetrieveUpdateDestroyAPIView.
• AppointmentListCreateAPIView
• AppointmentDetailAPIView

Expected Output
• Working template-based CRUD pages.
• Function-based views and class-based views implemented correctly.
• ModelForm used for create and update pages.
• Static CSS and JS loaded correctly.
• MySQL connection configured and migrations completed.
• REST APIs working through serializer, ModelViewSet, and generic API views.
• Screenshots of web pages and API responses included in submission.

3. Inventory Product Management System


Assessment Question: Build a Django application where a business can manage products, stock quantity, price, supplier
details, and product availability.

Web Pages to Create


1. Dashboard page
2. Product list page
3. Product detail page
4. Add product page
5. Edit product page
6. Delete product page
Template rule: Create a common [Link] file and make every page extend it. The base template should include a
navbar, footer, static CSS link, static JS link, and a block content section.

Model Requirement: Product


Field Name Suggested Type Notes / Choices
product_name CharField Required
sku CharField Unique value required
category CharField with choices Electronics, Groceries, Clothing, Stationery,
Furniture
description TextField Required
price DecimalField Required
quantity PositiveIntegerField Required
supplier_name CharField Required
is_available BooleanField True or False
created_at DateTimeField auto_now_add=True
updated_at DateTimeField auto_now=True

CRUD Requirements
1. Create a new product record.
Django CRUD Assessment Projects | Templates, CBVs, Forms, DRF APIs, MySQL
2. View all product records.
3. View complete details of a single product record.
4. Update an existing product record.
5. Delete an existing product record using a confirmation page.

Views Requirement
Use function-based views for:
• Dashboard page
• Product list page
• Product detail page
Use class-based views for:
• Add product using CreateView
• Edit product using UpdateView
• Delete product using DeleteView
Recommended CBVs: CreateView, UpdateView, DeleteView

Forms Requirement
Create a ModelForm named ProductForm. Use this form in both create and update operations.

Static Files Requirement (Optional)


static/
css/
[Link]
js/
[Link]
images/
• Style the navbar, forms, tables, cards, buttons, status labels, and delete confirmation page.

API Requirement Using Serializer and ModelViewSet


Create serializer: ProductSerializer using [Link].
Create ViewSet: ProductViewSet using ModelViewSet and register it with a DRF router.
Method Endpoint Purpose
GET /api/products/ Fetch all product records
POST /api/products/ Create a new product record
GET /api/products/<id>/ Fetch one product record
PUT /api/products/<id>/ Fully update one product record
PATCH /api/products/<id>/ Partially update one product record
DELETE /api/products/<id>/ Delete one product record

Generic Class-Based API View Requirement


Create generic API views using: ListCreateAPIView and RetrieveUpdateDestroyAPIView.
• ProductListCreateAPIView
• ProductDetailAPIView

Expected Output
• Working template-based CRUD pages.
• Function-based views and class-based views implemented correctly.
• ModelForm used for create and update pages.
• Static CSS and JS loaded correctly.
• MySQL connection configured and migrations completed.
• REST APIs working through serializer, ModelViewSet, and generic API views.
Django CRUD Assessment Projects | Templates, CBVs, Forms, DRF APIs, MySQL
• Screenshots of web pages and API responses included in submission.

4. Library Book Rental System


Assessment Question: Build a Django application where library staff can manage book rental records, borrower details,
return dates, status, and fine amount.

Web Pages to Create


1. Home page
2. Book rental list page
3. Rental detail page
4. Add rental page
5. Update rental page
6. Delete rental page
Template rule: Create a common [Link] file and make every page extend it. The base template should include a
navbar, footer, static CSS link, static JS link, and a block content section.

Model Requirement: BookRental


Field Name Suggested Type Notes / Choices
book_title CharField Required
author_name CharField Required
borrower_name CharField Required
borrower_email EmailField Required
rental_date DateField Required
return_date DateField Required
status CharField with choices Borrowed, Returned, Overdue, Lost
fine_amount DecimalField Default 0.00
created_at DateTimeField auto_now_add=True
updated_at DateTimeField auto_now=True

CRUD Requirements
1. Create a new book rental record.
2. View all book rental records.
3. View complete details of a single book rental record.
4. Update an existing book rental record.
5. Delete an existing book rental record using a confirmation page.

Views Requirement
Use function-based views for:
• Home page
• Book rental list page
• Rental detail page
Use class-based views for:
• Add rental using CreateView
• Update rental using UpdateView
• Delete rental using DeleteView
Recommended CBVs: CreateView, UpdateView, DeleteView

Forms Requirement
Create a ModelForm named BookRentalForm. Use this form in both create and update operations.
Django CRUD Assessment Projects | Templates, CBVs, Forms, DRF APIs, MySQL
Static Files Requirement (Optional)
static/
css/
[Link]
js/
[Link]
images/
• Style the navbar, forms, tables, cards, buttons, status labels, and delete confirmation page.

API Requirement Using Serializer and ModelViewSet


Create serializer: BookRentalSerializer using [Link].
Create ViewSet: BookRentalViewSet using ModelViewSet and register it with a DRF router.
Method Endpoint Purpose
GET /api/book-rentals/ Fetch all book rental records
POST /api/book-rentals/ Create a new book rental record
GET /api/book-rentals/<id>/ Fetch one book rental record
PUT /api/book-rentals/<id>/ Fully update one book rental record
PATCH /api/book-rentals/<id>/ Partially update one book rental record
DELETE /api/book-rentals/<id>/ Delete one book rental record

Generic Class-Based API View Requirement


Create generic API views using: ListCreateAPIView and RetrieveUpdateDestroyAPIView.
• BookRentalListCreateAPIView
• BookRentalDetailAPIView

Expected Output
• Working template-based CRUD pages.
• Function-based views and class-based views implemented correctly.
• ModelForm used for create and update pages.
• Static CSS and JS loaded correctly.
• MySQL connection configured and migrations completed.
• REST APIs working through serializer, ModelViewSet, and generic API views.
• Screenshots of web pages and API responses included in submission.

Common Commands
django-admin startproject project_name
cd project_name

python [Link] startapp app_name

python [Link] makemigrations


python [Link] migrate

python [Link] createsuperuser


python [Link] runserver

Required Packages
pip install django
pip install djangorestframework
pip install mysqlclient
If mysqlclient installation fails, candidates may use pymysql based on their local setup and explain the change in [Link].

Django CRUD Assessment Projects | Templates, CBVs, Forms, DRF APIs, MySQL
INSTALLED_APPS Requirement
INSTALLED_APPS = [
# default Django apps
'rest_framework',
'app_name',
]

Evaluation Criteria
Criteria Marks
MySQL database connection 10
Model creation and migrations 10
Template-based CRUD 10
Function-based views 10
Class-based views 10
Forms using ModelForm 10
Static files and base template 10
Serializer implementation 10
ModelViewSet APIs 10
Generic class-based API views 10
Total 100

Django CRUD Assessment Projects | Templates, CBVs, Forms, DRF APIs, MySQL

You might also like