0% found this document useful (0 votes)
7 views39 pages

Capstone Project Execution(Report)

The document is a project report for an Online Vehicle Parking Management System developed by students of Government Polytechnic Awasari as part of their Diploma in Computer Engineering. It outlines the project's objectives, methodology, and system functionalities, including user and admin interfaces for booking and managing parking slots. The report also includes acknowledgments, a literature review, and a detailed table of contents for the project's structure.

Uploaded by

Aditya Kudale
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)
7 views39 pages

Capstone Project Execution(Report)

The document is a project report for an Online Vehicle Parking Management System developed by students of Government Polytechnic Awasari as part of their Diploma in Computer Engineering. It outlines the project's objectives, methodology, and system functionalities, including user and admin interfaces for booking and managing parking slots. The report also includes acknowledgments, a literature review, and a detailed table of contents for the project's structure.

Uploaded by

Aditya Kudale
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
You are on page 1/ 39

GOVERNMENT POLYTECHNIC AWASARI (KHURD)

TAL - AMBEGAON, PUNE - 412405

Department of Computer Engineering

2021-22

SEMESTER - VI

Project Report of

Capstone Project Execution


On
ONLINE VEHICLE PARKING MANAGEMENT SYSTEM

Submitted by

Name of Student Roll Number Enrollment Number

Devade Mitali 21CO312 1910510081

Khairnar Shital 21CO331 1910510100

Wakchaure Vaishnavi 21CO361 1910510133

1
DEPARTMENT OF COMPUTER ENGINEERING
GOVERNMENT POLYTECHNIC AWASARI (KHURD)
SEMESTER-VI
2021-22

CERTIFICATE
This is to certify that the seminar entitled “ONLINE VEHICLE PARKING
MANAGEMENT SYSTEM” has been carried out by Mitali Devade(21CO312), Shital
Khairnar (21CO331) and Vaishnavi Wakchaure(21CO361) under my guidance in partial
fulfillment of the requirements for the Diploma in Computer Engineering of MSBTE, during
the academic year 2021-2022.

Name of Student Roll Number Enrollment Signature


Number
Devade Mitali 21CO312 1910510081

Khairnar Shital 21CO331 1910510100

Wakchaure Vaishnavi 21CO361 1910510133

Place: Awasari Khurd Date: / /

(Smt. J. P. Dandale) (Smt. J. R. Hange) (Dr. D.R. Nandanwar)

Guide Head, Computer Department Principal

2
ACKNOWLEDGEMENT

I have great pleasure and sense of satisfaction in presenting this project report on “Online
Vehicle Parking Management System” as part of the curriculum of Diploma in Computer
Engineering. Being novice in the field of designing and structuring in this project, it could have
been extremely difficult for me to complete this project on my own. I am very fortunate to be
guided by people with vast and resourceful experience in their respective field of work.

I express my sincere gratitude to my guide J. P. Dandale (Lecturer, Computer Engineering


Department) for her timely guidance, support and suggestions. I am also thankful for her
sincere help and for making me available all the facilities of the department. Without her efforts
and constant monitoring the project and documentation would not have been duly completed.
Also, I express my sincere thanks to Smt. J. R. Hange ( HOD Computer Department) , Besides,
I take this opportunity to express my sincere gratitude to the Principal Dr. D.R. Nandanwar,
G.P.Awsari for providing a good environment and facilities to complete this project. I would
also like to thank all my colleagues who have directly or indirectly guided and helped me in
the preparation of this project.

Devade Mitali
Khairnar Shital
Wakchaure Vaishnavi

3
ABSTRACT

The Online Vehicle Parking Management System is a system that enables


customers to reserve a parking space. It also allows the customer to view the parking status at
a particular city. It was developed because, we see if suppose we went at shopping outside at
market so there are so many parking problems, that’s why we can try to developed this
website for parking allocation. The requirement for the developed system were collected
using observation and interviewing the customer and staff member from Pune Bajar Peth/
Market place.
Online Parking Management System is a smart webpage software which helps user to
find places for parking which are registered in the webpage. The software’s main aim is to
give place for parking on a platform so that the searching of parking will be easy for user. In
this software, admin will register and login into the webpage and post the notice of parking
location by specifying all the details, like how many vacant places are available for parking
are available. The admin must have registered and login into the website and the user can
view the notices of parking location. Here in this system admin will give the places for
parking. Admin will upload a receipt for user that can be seen by the user and they can print
it.

4
TABLE OF CONTENTS

Sr.No Topic
Page No

1 Chapter 1
1.1 Introduction
1.2 Problem Statement
1.3 Proposed System
1.4 Objective of System 8

1.5 Software Requirement Specification


1.6 Hardware Requirement Specification

2 Chapter 2
2.1 Literature Survey
10
2.2 Course
Outcomes(COs)
3 Chapter 3

3.1 Methodology 11
3.2 Action Plan

4 Chapter 4

4.1 User
4.1.1 Sign In
4.2.2 Login
4.3.3 Home 12

4.4.4 Reserve
4.5.5 Checkout
4.6.6 Print Ticket
4.7.7 All Ticket
4.8.8 Logout

5
4.2 Admin
4.2.1 Login
4.2.2 Reservation
4.2.3 Add Parking Zone
4.2.4 Delete Parking Zone
4.2.5 Parking Zone
4.2.6 Logout
5 Chapter 5

5.1 Block Diagram


5.2 User Sign In Activity Diagram
5.3 User Login Activity Diagram
5.4 Admin Activity Diagram
15
5.5 User Activity Diagram
5.6 User Create Account Diagram
5.7 User Book Parking Slot Diagram
5.8 Data Flow Diagram
5.8.1 DFD Level 0
5.8.2 DFD Level 1
5.8.3 DFD Level 2
6 Chapter 6
6.1 User Test Cases
6.1.1 Login
6.1.2 Sign In
20
6.1.3 Reserve
6.1.5 Checkout
6.1.6 Logout

6
6.2 Admin Test Cases
6.2.1 Login
6.2.2 Add Parking Zone
6.2.3 Parking Zone
6.2.5 Reservation
7 Chapter 7
24
7.1 Project Code

8 Chapter 8
8.1 Project Output 31

9 Chapter 9
9.1 Future Enhancement 39
9.2 Conclusion
9.3 Reference

7
CHAPTER 1
1.1 Introduction
Now a days increasing number of cars and vehicles the parking is a big problem. We
can see when we are going in market for purchasing something, there are big issue is parking
our vehicles. We are observe this problem and that’s why we are implementing this web site
“Online Parking Management System”. In this website we allocated parking slots in specific
area. That is from admin side we allocated parking slot and from user side you can book this
slot. If you have to book this slot you can register to our website and you can feel the correct
information that you can see webpage/ on your screen. If you feel correct information then
parking slot allocate for you.
When you retrieve your vehicle then you have to paid some specific charges for parking.
When you paid parking charges then generate a payment slip on your screen and slip you can
download. Nowadays importance is given to the wireless technology and effective system.
Computers and technology have become part of our life for accessing almost everything we
basically do. Life now is full of indispensable technological advancement and in this
technological era it is very difficult for any organization to survive without technology. The
World Wide Web contributes enormously to the creation of an ever-increasing global
information database. It could also be used as a system to share information within an
enterprise. Online Parking Management System help to find place for parking to overcome
the difficulty of parking of hundreds and thousands of user and searching the eligible place
for parking, based on various locations. It helps in effective and efficient searching of the
place. User will create their accounts and can login. Based on the location from user the admin
will be allowed to proceed further. The user will then enter their details which will be
approved by administrator. Once approved, the user will get notified on every updates .

1.2 Problem Statement & Solution


People usually travel around within the parking regions trying to find appropriate place to
parking, to solve this problem, the online parking system has developed. Assistive technology
is needed, which may provide parking information for registered customer using the website.
User can obtain the service by registering, and in case of booking in particular area

8
1.3 Proposed System
This website provide us for online parking booking system for the vehicles. This website help
us for parking our vehicle at any market or any place. In this website we had several
advantages like It has user friendly interface, Fast access to database, Slot booking facility,
Slot price column, Parking city column, Parking location column, Quick transaction, Payment
receipt facility etc.

1.4 Objective of System


The objective of Online Vehicle Parking Management System is to provide support for booking
parking slot for vehicles and generating payment receipt when payment done for retrieving the
vehicle. Also provide facilities like create user account, login facility for user, booking slot for
vehicle, payment receipt.

1.5 Software Requirement Specification

Software Requirement Specification

Front End CSS, HTML, Javascript, Jquery


Back End Python Django Framework, SQL

1.6 Hardware Requirement Specification

Hardware Requirement Specification


Operating System Windows 10
Processor i3 Generation
RAM 8GB
ROM 1GB
Keyboard Standard windows keyboard

9
CHAPTER 2
2.1 Literature Review

Online Parking Management system for managing incoming and outgoing vehicles in a
particular area parking. It is very easy for admin to retrieve the data if the vehicle has been
visited through he can get that data. Now a days in many public places such a any bajar or
any public palaces there are very big problem of parking. This website provides us booking
online parking place at app
The objective of this project is to build Vehicle Parking Management System enables
the time management and control of vehicles using number plate recognition. The System
that will track entry and exit data of vehicles and also duration of parking. Each and every
process in the existing system is carried out manually. The searching of places for parking
for hours will be very time consuming for people. It becomes more difficult when number
of vehicles are increasing day by day. There are other limitations of existing system. In
Online Parking Management System all the task is done by human interventions.
Therefore, there is maximum chance of errors. Updating certain information is difficult
and ambiguous which may lead to data redundancy due to the chances of duplication of
information.

2.2 Course Outcomes

1) Implement the planned activity individually and/or as team.


2) Select collect and use required information /knowledge to solve the identified problem.
3) Take appropriate decisions based on collected and analysed information.
4) Ensure quality in product.
5) Asses the impact of project on society.
6) Communicate effectively and confidently as a member and leader of team.
7) Prepare project report after performing due plagiarism check using appropriate tools.

10
CHAPTER 3

3.1 Methodology
We have planned the micro-project of “Online Vehicle Management System”
under the guidance of subject teacher. Then our team collected information related to from
syllabus book as well reference book. We took the reference from other website that are
available on internet. We studied about the different component.
After the studied of one week, we designed and Then we have finalized the project and
prepared report on this micro-project.

3.2 Action Plan

Sr. Details of activity Planned Planned Name of


No. Start date Finish date Responsible
Team
Members

1 Creation of setup for project. 21/02/2022 26/02/2022


Mitali
Devade
2 Development of User View of project. 26/02/2022 18/03/2022

3 Development of Admin View of project. 18/03/2022 13/04/2022

Shital
Khairnar
4 Checking of User view and Admin view 13/04/2022 21/04/2022
by mentor

5 Testing of User View of project. 21/04/2022 05/05/2022

Vaishnavi
6 Testing of Admin View of project. 05/05/2022 15/05/2022
Wakchaure

7 Checking of project report and diary by 15/05/2022 24/05/2022


mentor

8 Submission of Project 24/05/2022 02/06/2022

11
CHAPTER 4

4.1 User

4.1.1 Sign in

• When user visited this website for first time he has to create his account.
• For creating account we have to filled some information.
• The first filled is Username. For username we have limit for 150 characters. We can
use characters, symbols, and digits for Username.
• The next field is password. There are also some limit for password.
• We have to enter at least 8 characters for password.
• Password may contain some symbol, digits, and characters. When we enter password,
password should unique it not similar to your personal information.
• Next field is confirmation of password we have to enter same password in this field.
• The last on is create account button. After filled all information just click on create
account button.

4.1.2 Login

• The login module , when we login we have enter username and password.
• For username we have entered same user name that we entered for creating account.
• For password same like username we have entered same password which we entered for
creating account.
• After filled all information just click on Login button.
• Also in login module there are also sign in option.
• From this sign in option we can also sign in for this website.

4.1.3 Home

• After login home page will displayed. Home page is the main page of our app.
• Name of our homepage is “My Parking Spot”.
• On the homepage we are provided 2 modules first is ”Reserve” and second is “Checkout”.
• On the home page we are displayed 1 table related to parking zones.
• In that table we are displayed four filled parking zone, location, vacant slot. And price.
• At the top of homepage we are provided helpline number and also email id
• And also we are provided one side bar. In that side bar we are mentioned total 7 modules.
• Home, Account, Print Ticket, All Ticket, Reserve Parking ,Checkout Parking and Logout.

12
4.1.4 Reserve

• In Reserve module we are provided book parking form.


• In the form we mentioned some filled for the parking. There are 5 fields to filled.
• Fields are: Start date, Finish date, Parking zone, Plate number, Phone number & one
button.
• After fill all information just click on Book button.

4.1.5 Checkout

• This field we mention for checkout.


• This module provide the facility to checkout when user retrieve their vehicle.
• If user reserve the parking zone when user have to leave the parking zone so for that we
can checkout from the website.

4.1.6 Print Ticket

• When user checkout and retrieve their vehicle then receipt will generated.
• In this receipt we mentioned fields are at the top of receipt we generate a ticket code, then
parking status, phone number, start date, finish date, Parking zone, Plate number & Price.
• The ticket will generate in pdf format.
• We can download that pdf click on download button.
• Also we can print it into a hard copy.

4.1.7 All Tickets

• The all ticket module generate the all print ticket


• We give a name for the page is “Ticket Records” it is from user side
• Suppose one user login more than 1 time with same username and password then it will
shows us how many time user login and book a parking zone.

4.1.8 Logout

• When user have leave our side then we will provide a module logout
• Just click on logout button user can leave from app.

13
4.2 Admin

4.2.1 Login

• The login module , when we login we have enter username and password.
• For username we have entered same user name that we entered for creating account.
• For password same like username we have entered same password which we entered for
creating account.
• After filled all information just click on Login button.
• Also in login module there are also sign in option.
• From this sign in option we can also sign in for this app.

4.2.2 ogout

• When user have leave from admin site then we will provide a module logout
• Just click on logout button user can leave from admin site.

4.2.3 Reservation

• In this module we viewed all user reserved details.


• We can search a user in the search bar.
• We have to enter ticket code for searching a user details.

4.2.4 Parking Zone

• In this module we viewed all Parking zones.


• We can search a parking zone in the search bar.
• We have to enter Parking zone name for searching a parking zone.

4.2.5 Add parking zone

• In this Add parking zone we are provided some fields.


• First we have to enter parking zone name in the field.
• Then next field is how many slot we have to allocate in that particular zone.
• We have to displayed to the user from the number of slot how many slot occupied and
how many slot vacant.
• The next field is address, we have give the proper address that where we are provide a
parking zones.
• And the last is we have to allocate price for per vehicle.

14
CHAPTER 5

5.1 Block Diagram

5.2 User Activity Diagram

15
5.3 Admin Activity Diagram

5.4 User Login Activity Diagram

16
5.5 User Sign In Activity Diagram

5.7 User Book Parking Slot Diagram

17
5.8 Data Flow Diagram

5.8.1 DFD Level 0

5.8.2 DFD Level 1

18
5.8.3 DFD Level 2

19
CHAPTER 6

6.1 User Test Cases

6.2.1 Login

Module Test Test Case Input Expected Actual Status


Case ID Objective Result Result
TC_1 Check Enter valid The valid The valid PASS
The username(ex: username username
Username admin) should be expected
Login field expected
TC_2 Check Enter valid The valid The valid PASS
The password(a-z, A- password password
password Z, 0-9,Special should be expected
field characters) expected

6.2.3 Sign In

Module Test Test Case Input Expected Actual Status


Case ID Objective Result Result
TC_3 Check The Enter valid The valid The valid PASS
Username username(150 username usernam
field characters,@/./=/- should be e
/_) expected expected
TC_4 Check The Enter valid The valid The valid PASS
Sign In password password(8 password password
field characters, not should be expected
numeric ) expected
TC_5 Check The Enter valid The valid The valid PASS
confirm password(a-z, A- password password
password Z, 0-9,Special should be expected
field characters) expected

6.2.5 Logout

Module Test Test Case Input Expected Actual Status


CaseID Objective Result Result
TC_13 Verify Click on log out It should It is PASS
Logout logout button be logout logout
button account the
account

20
6.2.2 Reserve

Module Test Test Case Input Expected Actual Status


Case ID Objective Result Result
TC_6 Check the Enter valid start The valid The valid PASS
start Date date for reserve start date start date
parking should be expected
expected
TC_7 Check the Enter valid finish The valid The valid PASS
finish date for reserve finish date finish date
Date parking should be expected
expected
TC_8 Check Select valid The valid The valid PASS
parking parking zone parking parking
zone zone zone
Reserve should be expected
expected
TC_9 Check Enter valid The valid The valid PASS
vehicle vehicle plate vehicle vehicle
Plate number plate plate
number number number
should be expected
expected
TC_10 Check Enter valid phone The valid The valid PASS
user number( phone phone
Phone number number
number should be expected
expected

6.2.4 Checkout

Module Test Test Case Input Expected Actual Status


Case Objective Result Result
ID
TC_11 Check Enter valid The valid The valid PASS
User user user user
reservation reservation reservation reservation
should be not
valid expected
Checkout TC_12 Check Enter valid The valid The valid PASS
User user user user
reservation reservation reservation reservation
should be expected
expected

21
6.2 Admin Test Cases

6.2.1 Login

Module Test Test Case Input Expected Actual Status


Case Objective Result Result
ID
TC_1 Check The Enter valid The valid The valid PASS
Username username(ex: username username
field admin) should be expected
expected
Login
TC_2 Check The Enter valid The valid The valid PASS
password password(a-z, password password
field A-Z, 0- should be expected
9,Special expected
characters)

6.2.2 Add Parking Zone

Module Test Test Case Input Expected Actual Status


Case Objective Result Result
ID
TC_3 Check the Enter valid The valid The valid PASS
parking parking zone parking parking
zone name name zone name zone name
field should be expected
expected
TC_4 Check the Enter the The valid The valid PASS
number of number of slot number of number of
Add slot field slot should slot
Parking be expected expected
Zone TC_5 Check the Enter the The valid The valid PASS
occupied number of number of occupied
slot field occupied slot occupied slot
slot should expected
be expected
TC_6 Check the Enter the The valid The valid PASS
vacant slot number of number of vacant slot
field vacant vacant slot expected
slot(vacant should be
slot=number of expected
slot-occupied
slot)

22
TC_7 Check the Enter the The valid The valid PASS
address address of address of address of
field parking zone parking parking
zone should zone
be expected expected
TC_8 Check the Enter the price The valid The valid PASS
price zone of per vehicle price of per price of
parking vehicle per vehicle
should be expected
expected

6.2.2 Parking Zone

Module Test Test Case Input Expected Actual Status


Case Objective Result Result
ID
TC_9 View all Viewed all Viewed Viewed PASS
parking parking zone parking parking
zone zone should zone
be expected expected
Parking
TC_10 Search Enter parking Enter Enter PASS
Zone
parking zone in search parking parking
zone bar zone in zone in
search bar search bar
should be expected
expected

6.2.2 Reservation

Module Test Test Case Input Expected Actual Status


Case Objective Result Result
ID
TC_11 View all Viewed all Viewed all Viewed PASS
user user reserved user user
reserve details reserved reserved
details details details
should be expected
Reservation expected
TC_12 Search Enter user Enter ticket Enter PASS
user details using code in ticket
details ticket code in search bar code in
search bar should be search bar
expected expected

23
CHAPTER 7

• views.py

from django.shortcuts import render, redirect


from django.views import View
from .models import Reservation, Parking_Zone
from django.db.models import Q
from django.contrib import messages
from .forms import ReservationForm
from django.contrib.auth.decorators import login_required
from django.core.exceptions import ObjectDoesNotExist
from .models import Reservation

from django.utils import timezone


from .render import Render

import random
import string

def create_ticket_code():
return ''.join(random.choices(string.ascii_lowercase + string.digits, k=6))

class ReservationView(View):
def get(self, request):
try:
user_reservation = Reservation.objects.get(customer=request.user,
checked_out=False)
if user_reservation:
messages.warning(self.request, 'Please Check Out Your Previous Reservation')
return redirect('index')
except ObjectDoesNotExist:
pass

reservation = ReservationForm()

return render(request, 'parking_zones/booking.html', {'form': reservation})

def post(self, request):


try:
user_reservation = Reservation.objects.get(customer=request.user,
checked_out=False)
if user_reservation:
messages.warning(self.request, 'Please Check Out Your Previous Reservation')
return redirect('index')

except ObjectDoesNotExist:

24
pass
reservation_form = ReservationForm(data=request.POST)

if reservation_form.is_valid():
start_date = reservation_form.cleaned_data['start_date']
finish_date = reservation_form.cleaned_data['finish_date']
parking_zone = reservation_form.cleaned_data['parking_zone']
plate_number = reservation_form.cleaned_data['plate_number']
parkingzone = Parking_Zone.objects.get(name=parking_zone)
if parkingzone.vacant_slots == 0:
messages.warning(self.request, 'Parking Zone Full!')
return redirect('index')

reservation = reservation_form.save(commit=False)
reservation.customer = request.user
reservation.parking_zone = parking_zone
reservation.ticket_code = create_ticket_code()
reservation.save()
#parkingzone = Parking_Zone.objects.get(name=parking_zone)
parkingzone.occupied_slots += 1
parkingzone.save()
vacantslots = int(parkingzone.num_of_slots) - int(parkingzone.occupied_slots)
parkingzone.vacant_slots = vacantslots
parkingzone.save()
messages.info(request, 'Successfully Booked')
return redirect('index')

return render(request, 'parking_zones/booking.html', {'form': reservation_form})

class Ticket_Pdf(View):

def get(self, request):

today = timezone.now()
reservation = Reservation.objects.filter(Q(customer=request.user, checked_out=False) |
Q(customer=request.user, checked_out=True))
if reservation:
params = {
'today': today,
'reservation': reservation.first(),
'request': request
}
return Render.render('parking_zones/ticket.html', params)
else:
messages.warning(self.request, f'No Parking reservation exists for {self.request.user}')
return redirect('index')
class Display_Tickets(View):
def get(self, request):

25
today = timezone.now()
reservations = Reservation.objects.filter(customer=self.request.user)
if reservations:
context = {
'today': today,
'reservations': reservations,
'request': request
}
return render(request, 'parking_zones/all_tickets.html', context)
else:
messages.warning(self.request, f'No Parking reservation exists for {self.request.user}')
return redirect('index')

@login_required
def check_out(request):
try:
reservation = Reservation.objects.get(customer=request.user, checked_out=False)
if reservation:
reservation.checked_out = True
reservation.save()
parking_zone_name = reservation.parking_zone.name
parking_zone = Parking_Zone.objects.get(name=parking_zone_name)
parking_zone.occupied_slots -= 1
parking_zone.vacant_slots += 1
parking_zone.save()
messages.info(request, 'Successfully Checked Out')

except ObjectDoesNotExist:
messages.warning(request, f'No Parking reservation exists for {request.user}')

return redirect('index')

• urls.py

from django.contrib import admin


from django.urls import path, include
from django.contrib.auth.decorators import login_required
from parking_zones import views as parkingzoneviews
from users import views as users_views

urlpatterns = [
path('', include('source.urls')),
path('admin/', admin.site.urls),
path('user/signup/', users_views.signup_view, name='signup'),
path('user/login', users_views.user_login, name='login'),
path('user/logout/', users_views.user_logout, name='logout'),
path('book/', login_required(parkingzoneviews.ReservationView.as_view()), name='book'),

26
path('ticket/', login_required(parkingzoneviews.Ticket_Pdf.as_view()), name='ticket'),
path('all_tickets/', login_required(parkingzoneviews.Display_Tickets.as_view()), name='all-
tickets'),
path('checkout/', parkingzoneviews.check_out, name='checkout')
]

• forms.py

import datetime
from django.forms import ModelForm, DateInput, TextInput, ValidationError
from .models import Reservation
from django.contrib import messages
class ReservationForm(ModelForm):
class Meta:
model = Reservation
exclude = ['ticket_code', 'customer', 'checked_out']
# Validating form fields using widgets
widgets = {
'start_date': DateInput(attrs={'type': 'date'}),
'finish_date': DateInput(attrs={'type': 'date'}),
# 'plate_number': TextInput(attrs={'pattern': '^K[A-Z]{2}[0-9]{3}[A-Z]$', 'title': 'Enter
a valid parking space number'}),
'plate_number': TextInput(),
'phone_number': TextInput(attrs={'pattern': '[0-9]+', 'title': 'Enter digits only '}),
}

# Additional custom validator for start_date / finish_date fields


def clean(self):
data = self.cleaned_data
start_date = data['start_date']
finish_date = data['finish_date']

if start_date > finish_date:


raise ValidationError('Wrong start and finish dates.')

if start_date < datetime.date.today():


raise ValidationError('Start date in the past.')

return data

• models.py

from django.db import models


from django.urls import reverse
from django.contrib.auth.models import User
from django.utils import timezone

27
class Parking_Zone(models.Model):
name = models.CharField(max_length=200)
slug = models.SlugField(max_length=200, unique=True)
num_of_slots = models.PositiveIntegerField()
occupied_slots = models.PositiveIntegerField(null=True, blank=True, default=0)
vacant_slots = models.PositiveIntegerField(null=True, blank=True, default=0)
address = models.CharField(max_length=200)
price = models.PositiveIntegerField()

def __str__(self):
return self.name

def get_absolute_url(self):
return reverse('parkingzone-detail', kwargs={
'slug': self.slug
})

class Reservation(models.Model):
ticket_code = models.CharField(max_length=6, blank=True, null=True)
customer = models.ForeignKey(User, on_delete=models.CASCADE)
start_date = models.DateField()
finish_date = models.DateField()
parking_zone = models.ForeignKey(Parking_Zone, on_delete=models.CASCADE)
plate_number = models.CharField(max_length=10)
phone_number = models.CharField(max_length=16)
checked_out = models.BooleanField(default=False)
created_on = models.DateTimeField(auto_now_add=True)

class Meta:
ordering = ['-created_on']

def __str__(self):
return f'Reservation for vehicle: {self.plate_number}'

• render.py

from io import BytesIO


from django.http import HttpResponse
from django.template.loader import get_template
import xhtml2pdf.pisa as pisa

class Render:

@staticmethod
def render(path: str, params: dict):
template = get_template(path)
html = template.render(params)
response = BytesIO()

28
pdf = pisa.pisaDocument(BytesIO(html.encode("UTF-8")), response)
if not pdf.err:
return HttpResponse(response.getvalue(), content_type='application/pdf')
else:
return HttpResponse("Error Rendering PDF", status=400)

• admin.py

from django.contrib import admin

from .models import Parking_Zone, Reservation

class Parking_ZoneAdmin(admin.ModelAdmin):
list_display = ('name', 'num_of_slots','occupied_slots', 'vacant_slots', 'address', 'price',)
list_filter = ('address',)
prepopulated_fields = {'slug': ('name',)}
search_fields = ('name',)

class Reservation_Admin(admin.ModelAdmin):
list_display = ('ticket_code', 'customer', 'start_date', 'finish_date', 'parking_zone',
'plate_number', 'phone_number', 'checked_out', 'created_on')
list_filter = ('start_date', 'finish_date', 'parking_zone', 'checked_out')
search_fields = ('ticket_code', 'plate_number')

admin.site.register(Parking_Zone, Parking_ZoneAdmin)
admin.site.register(Reservation, Reservation_Admin)

• views.py

from django.shortcuts import render, redirect

from parking_zones.models import Parking_Zone, Reservation

from django.contrib import messages

def index(request):
context = {
'all_parking_zones':Parking_Zone.objects.all()
}
return render(request, 'source/index.html', context)

def parking_status(request, slug):


all_parking_zones = Parking_Zone.objects.all()
parking_zone = all_parking_zones.get(slug=slug)
context = {
'parking_zone': parking_zone,

29
}
return render(request, 'source/status.html', context)

• views.py

from django.shortcuts import render, redirect


from django.contrib.auth.forms import UserCreationForm, AuthenticationForm
from django.contrib import messages
from django.contrib.auth import authenticate, login, logout

def signup_view(request):
if request.method == 'POST':
form = UserCreationForm(request.POST)
if form.is_valid():
form.save()
username = form.cleaned_data.get('username')
messages.success(request, f'Succesfully Created user {username}. You can now login')
return redirect('login')
else:
form = UserCreationForm()
context = {
'form' : form
}
return render(request, 'users/signup.html', context)

def user_login(request):
form = AuthenticationForm()
if request.method == 'POST':
username = request.POST['username']
password = request.POST['password']
user = authenticate(username=username, password=password)
if user is not None:
login(request, user)
if user.is_authenticated:
messages.success(request, f'User {username} Successfully Logged in')
return redirect('index')
else:
messages.warning(request, 'invalid Credentials')
context = {
'form': form
}
return render(request, 'users/login.html', context)

def user_logout(request):
logout(request)
messages.success(request, 'Successfully logged out')
return redirect('login')

30
CHAPTER 8

❖ Sign In

❖ Login

31
❖ Side Bar [ Login Page]

❖ Nav Bar [ Login ]

32
❖ Home Page

❖ Side Bar [ Home Page ]

33
❖ Book Parking

❖ Print Ticket

34
❖ All Print Ticket

❖ Nav Bar [ Book Parking ]

35
❖ Nav Bar [ Checkout Parking ]

❖ Admin Panel

36
❖ Parking Zone

❖ Add Parking Zone

37
❖ Delete Parking Zone

❖ Reservation

38
CHAPTER 9

9.1 Future Enhancement

In the current context, increasing the parking capacity would be a challenge due to the
growing scarcity of available urban space, while decreasing the demand will subdue citizens’
mobility experience. In this context, the future of parking will emerge as an ecosystem play.

9.2 Conclusion

Adopting parking management system significantly reduces the amount of time


consumed in seeking the parking space, renders valuable data upon the availability of
the parking area, accurate mapping of the parking space, offers guidance and suggestion
for proper vehicle parking .

9.3 Reference

www.javatpoint.com
www.w3school.com
www.tutorialspoint.com

39

You might also like