Online Car Rental System in Django with Source Code
This Online Car Rental System Project in Django created using Python Django Framework on the backend and HTML, and JavaScript on the frontend. A college project using the Python programming language, the Django framework, and MySQL as the database. The Online Car Rental System has three modules One for car dealers, one for clients, and one for the home page are among the three modules. Models, URLS, and views are handled by each app in the usual Django way.
The Online Car Rental system works as follows: a car dealer visits the car dealer portal, registers, and uploads cars that he believes are available for rental.
Customer logs into the customer portal, specifies the area in which he wants the car, and the system searches all available car-dealers and their vehicles in that area, displaying the results to the customer. If the car has already been rented.
The primary goal of this Online Car Rental system project was to learn the Django framework, handle backend tasks, and manage databases, no bootstrap or other CSS frameworks were used.
I have used the local MYSQL database, and the python classes in models.py assisted in database management and upgrading. The database configuration can be found in ocrs/ocrs/settings.py, where you can add your own database, username, and password in the DATABASE section.
Watch the video here to see the full running Online Car Rental System in Django with Source Code
To start creating a Online Car Rental system Project in Python Django, makes sure that you have PyCharm Professional IDE Installed in your computer.
This Online Car Rental system in Django Framework, Also includes a Download Source Code for free, just find the downloadable source code below and click download now.
Admin Features of Online Car Rental system in Django
- Sign up – The admin needs to sign up first to create an account.
- Login – After creating an account, The admin need to login first to enable to access the system.
- Manage Order – For the order, The admin can view order of the customer.
- Sales Management – The admin can view the daily sales.
- Manage Vehicle – The admin can add, update, and delete vehicle information.
- Homepage – In the homepage you can see the orders, sales, home, and vehicles.
User Features of Online Car Rental system in Django
- Sign up – The user needs to sign up first to create an account.
- Login – After creating an account, The user need to login first to enable to access the system.
- Search Car– For the search car, The user will search a car to rent.
- Rent Car – The user can update, delete orders and view the car details.
Online Car Rental system in Django Steps on How to Create a Project
Time needed: 5 minutes.
Here’s the step’s on how to create a Online Car Rental system in Django
- Step 1: Open file.
First , open “pycharm professional” after that click “file” and click “new project“.
- Step 2: Choose Django.
Next, after click “new project“, choose “Django” and click.
- Step 3: Select file location.
Then, select a file location wherever you want.
- Step 4: Create application name.
After that, name your application.
- Step 5: Click create.
Lastly, finish creating project by clicking “create” button.
- Step 6: Start Coding.
Finally, we will now start adding functionality to our Django Framework by adding some functional codes.
Functionality and Codes of the Online Car Rental system in Django
- Create template for the homepage in Online Car Rental system in Django
In this section, we will learn on how create a templates for the homepage. To start with, add the following code in your index.html under the folder of home/templates/home.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
{% load static %} <html> <head> <title>Online Car Rental System</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="{% static 'css/w3.css' %}"> </head> <body> <div class="w3-container w3-teal"> <h1 class="w3-center">Online Car Rental System<h1> </div> <div class="w3-center w3-bar w3-red w3-large"> Welcome to online car rental system</div><br><br> <div class="w3-display-container" style="height:400px;"> <div class="w3-display-middle"> <form class="w3-container w3-center" action="/customer_portal/login/" mehtod="POST">{% csrf_token %} <input class="w3-green w3-btn w3-large w3-round-large w3-padding-32" type="submit" value="Customer Login"> </form> <br><br><br> <form class="w3-container w3-center" action="/car_dealer_portal/login/" method="POST">{% csrf_token %} <input class="w3-btn w3-blue w3-large w3-round-large w3-padding-32" type="submit" value="Admin Login"> <form> </div> </div> <body> </html> |
- Create template for the login form in Online Car Rental system in Django
In this section, we will learn on how create a templates for the login form. To start with, add the following code in your login.html under the folder of customer_portal/templates/customer.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
{% extends 'customer/base.html' %} {% block content %} {% if form.errors %} {% endif %} <div class="w3-display-container" style="height:500px;"> <div class="w3-display-middle"> <form class="w3-container" action="/customer_portal/auth/" method="POST">{% csrf_token %} <lable>Username :</lable> <input class="w3-input" type="text" name="username"><br><br> <lable>Password :</lable> <input class="w3-input" type="password" name="password"><br><br> <input class="w3-btn w3-green" type="submit"> </form><br><br> <div class="w3-container"> <a class="w3-btn w3-red" href="/customer_portal/register/">New User ? Sign up Here</a> <a class="w3-btn w3-blue" href="/">Home</a> </div> </div> </div> {% endblock %} |
- Create template for the registration form in Online Car Rental system in Django
In this section, we will learn on how create a templates for the registration form. To start with, add the following code in your register.html under the folder of home/templates/home.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
{% extends 'customer/base.html' %} {% block content %} <div class="w3-bar"> <h3 class="w3-bar-item w3-left">Registration Form</h3> <a class="w3-bar-item w3-right w3-btn w3-teal" href="/customer_portal/login/">Login</a> <a class="w3-bar-item w3-right w3-btn w3-teal" href="/">Home</a> </div> <div class="w3-display-container" style="height:1000px;"> <div class="w3-display-middle"> <form class="w3-container" action="/customer_portal/registration/" method="POST">{% csrf_token %} <lable>FirstName : </lable><input class="w3-input" type="text" name="firstname"><br><br> <lable>LastName : </lable><input class="w3-input" type="text" name="lastname"><br><br> <lable>Username : </lable><input class="w3-input" type="text" name="username"><br><br> <lable>Password : </lable><input class="w3-input" type="password" name="password"><br><br> <lable>Email : </lable><input class="w3-input" type="text" name="email"><br><br> <lable>Mobile : </lable><input class="w3-input" type="text" name="mobile"><br><br> <lable>City : </lable><input class="w3-input" type="text" name="city"><br><br> <lable>Pincode : </lable><input class="w3-input" type="text" name="pincode"><br><br> <input class="w3-btn w3-teal" type="submit"><br><br> </form> </div> </div> {% endblock %} |
- Create template for the order in Online Car Rental system in Django
In this section, we will learn on how create a templates for the order. To start with, add the following code in your manage.html under the folder of home/templates/home.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
{% extends 'customer/base.html' %} {% block content %} <div class="w3-bar w3-large w3-black"> <div class="w3-bar-item w3-left w3-black">Welcome: {{user.username}}</div> <a class="w3-bar-item w3-btn w3-black w3-right" href="/customer_portal/logout/">Logout</a> <a class="w3-ber-item w3-btn w3-green w3-right" href="/customer_portal/search/">Search for cars</a> </div> <h4 class="w3-center" style="padding-top:50">Your orders</h4> <div class="w3-center" style="padding:100px;"> <table class="w3-table w3-striped w3-center"> {% for order in od %} <tr> <td>name : {{order.vehicle.car_name}}</td> <td>days : {{order.days}}</td> <td>rent : {{order.rent}}</td> <td>capacity : {{order.vehicle.capacity}}</td> <td>description : {{order.vehicle.description}}</td> <td>pincode : {{order.vehicle.area.pincode}}</td> <td><form action = "/customer_portal/delete/" method="post"> {% csrf_token %} <input type="hidden" name="id" value="{{order.id}}"> <input class="w3-btn w3-red" type="submit" value="delete"> </form> </td> <td> <form action = "/customer_portal/update/" method="post"> {% csrf_token %} <input type="hidden" name="id" value="{{order.id}}"> <input class="w3-btn w3-green" type="submit" value="update"> </form> </td> </tr> {% endfor %} </table> </div> {% endblock %} |
- Create template for the confirmation in Online Car Rental system in Django
In this section, we will learn on how create a templates for the confirmation. To start with, add the following code in your confirmation.html under the folder of home/templates/home.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
{% extends 'customer/base.html' %} {% block content %} <div class="w3-bar w3-large w3-black"> <div class="w3-bar-item w3-left w3-black">Welcome: {{user.username}}</div> <a class="w3-bar-item w3-btn w3-black w3-right" href="/customer_portal/logout/">Logout</a> <a class="w3-bar-item w3-btn w3-black w3-right" href="/customer_portal/manage/">Manage</a> <a class="w3-ber-item w3-btn w3-green w3-right" href="/customer_portal/search/">Search for cars</a> </div> {% csrf_token %} <div class="w3-display-container" style="height:400px;"> <div class="w3-display-middle"> <h3>Order Completed</h3> Your vehicle order was successful !<br><br> total rent : {{order.rent}} Rs.<br><br> vehicle : {{order.vehicle.car_name}}<br><br> duration : {{order.days}} days<br><br> car-dealer : {{order.car_dealer.car_dealer.first_name}} {{order.car_dealer.car_dealer.last_name}}<br><br> car-dealer contact no: {{order.car_dealer.mobile}}<br><br> </div> </div> {% endblock %} |
- Create template for the search in Online Car Rental system in Django
In this section, we will learn on how create a templates for the search. To start with, add the following code in your index.html under the folder of home/templates/home.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
{% extends 'customer/base.html' %} {% block content %} <div class="w3-bar w3-large w3-black"> <div class="w3-bar-item w3-left w3-black">Welcome: {{user.username}}</div> <a class="w3-bar-item w3-btn w3-black w3-right" href="/customer_portal/logout/">Logout</a> <a class="w3-bar-item w3-btn w3-black w3-right" href="/customer_portal/manage/">Manage</a> <a class="w3-ber-item w3-btn w3-green w3-right" href="/customer_portal/search/">Search for cars</a> </div> <h4 class="w3-center" style="padding-top:50">Search Results</h4> <div class="w3-center" style="padding:100px;"> <table class="w3-table w3-striped w3-center w3-large"> {% for vehicle in request.session.vehicles_list %} <tr> <td style="padding:20">vehicle : {{vehicle.name}}</td> <td style="padding:20">color : {{vehicle.color}}</td> <td style="padding:20">capacity : {{vehicle.capacity}}</td> <td style="padding:20">description : {{vehicle.description}}</td> <td style="padding:20">pincode : {{vehicle.pincode}}</td> <td style="padding:20"><form action = "/customer_portal/rent/" method="post"> {% csrf_token %} <input type="hidden" name="id" value="{{vehicle.id}}"> <input class="w3-btn w3-green" type="submit" value="rent"> </form> </td style="padding:20"> </tr> {% endfor %} </table> </div> {% endblock %} |
Run Quick Virus Scan for secure Download
Run Quick Scan for safe DownloadDownloadable Source Code Below.
Anyway, if you want to level up your programming knowledge, especially python, try this new article I’ve made for you Best Python Projects with source code for Beginners. But If you’re going to focus on web development using Django, you can download here from our list of Best Django Projects with source code based on real-world projects.
How To Run The Online Car Rental system in Django?
- Step 1: Extract/unzip the file
- Step 2: Go inside the project folder, open cmd and type the following commands to install Django Framework and run the webserver:
- python manage.py runserver
- Step 3: Finally, open the browser and go to http://127.0.0.1:8000/
Summary
In summary, this 2021 Online Car Rental system in Django with Source Code can be useful to students or professional who wants to learn python programming language. This project can also be modified to fit your personal requirements. Hope this project will help you to improve your skills. Happy Coding!
- How To Make A Point Of Sale System In Python
- Best Python Projects for Beginners
- Python MySQL Connection: Simple Python Step by Step Guide
- Python PIP Command Set-up / Fix: Step by Step Guide
- Random Password Generator in Python Projects With Source Code 2020
- Python Range Function|Range in Python Explained with Examples 2020
- School Management System Project In Django With Source Code
- Django Login And Registration With Source Code
- CRUD App In Django With Source Code
- Drag And Drop JavaScript With Source Code
- Todo List App Django With Source Code
- Railway Reservation System Project in Django with Source Code
- File Management System Project in Django with Source Code
- Event Management System Project in Django with Source Code
Inquiries
If you have any questions or suggestions about Online Car Rental system in Django with Source Code, please feel free to leave a comment below.