Hostel Management System in Django with Source Code
The Hostel Management System in Django is created using Python Django Framework. The system is built fully in Django Framework in back-end and HTML, CSS and JavaScript in front-end. Basically, the project includes tutorials and guides for creating a code.
This Hostel Management System focuses on the challenges of running a hostel and how to eliminate the problems that arise while doing so manually. Identifying the shortcomings of the current system leads to the creation of a computerized system that is consistent with the current system while being more user friendly and GUI driven.
To start creating a Hostel Management System Project, makes sure that you have PyCharm Professional IDE Installed in your computer.
Watch the video here to see the full running Hostel Management System in Django With Source Code
This Hostel Management System in Django also includes a Download Source Code for free, just find the downloadable source code below and click download now.
Features of Hostel Management System in Django
- Login – For the login, you must login first before you can access the system.
- Sign Up– For the sign up, you will fill the forms. Such as your username, password and email address.
- View Room Details – the admin can view room details.
- Student Registration – For the Student Registration, The admin can add, update, and delete student registration.
- Billing – For the billing, the admin can manage the billing in the system.
- User Management – For the user, The admin can add, update, and delete users information.
- Room Management – For the room, The admin can add, update, and delete rooms.
- Visitor Management – For the visitor, The admin can add, update, and delete visitors information.
- Guest Booking – For the guest booking, The admin can reject or accept the guest booking requested.
Hostel Management System in Django With Source Code Steps on How to Create a Project
Time needed: 5 minutes.
These are the steps on how to create a Hostel Management System in Django
- Step 1: Open file.
First , open “pycharm professional” after that click “file” and click “new project“.
- Step 2: Choose Django.
Next, 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.
This are the codes to add functionality for Hostel Management System in Django With Source Code
- Create template for the homepage in Hostel Management 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 base.html under the folder of guest/templates/guest files.
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 |
<body> <div class="nav"> <div class="nav-header"> <div class="nav-title"> <a href="{% url 'guest:start' %}">Guest House Booking</a> </div> </div> <div class="nav-links"> {% block more_links %} {% endblock more_links %} </div> </div> <div> {% block content %} {% endblock content %} </div> <div class="copyright" align="center" > 2021 © Hostel Management System </div> </body> |
- Create template for the login form in Hostel Management 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 guest/templates/guest files.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
{% extends 'guest/base.html' %} {% block content %} <div class="wrap"> <form action="" method="post"> {% csrf_token %} <div class="fields"> Username <br><br> {{ form.username }}</div> <div class="fields"> Password <br><br> {{ form.password }}</div> <input class="button-custom" type="submit" value="LOGIN"> </form> </div> {% endblock content %} {% block more_links %} <a href="{% url 'guest:login' %}">Login</a> <a href="{% url 'guest:register' %}">Register</a> {% endblock more_links %} |
- Create template for the registration form in Hostel Management 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 reg_form.html under the folder of guest/templates/guest files.
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 39 40 41 |
{% extends 'guest/base.html' %} {% block content %} <div class="wrap"> <form method="post" action = ""> {% csrf_token %} <div class="fields"> Username <br><br> {{ form.username }}</div> <div class="fields"> Password <br><br> <div class = 'error1' > {% if error1 %} <p style="color: red;"> Please enter password of atleast 8 characters or more. </p> {% endif %} </div> {{ form.password1 }} </div> <div class="fields"> Repeat Password <br><br> <div class="error2"> {% if error2 %} <p style="color: red;"> Please enter confirm password (same as password) </p> {% endif %} </div> {{ form.password2 }} </div> <input class="button-custom" type="submit" value="REGISTER"> </form> </div> {% endblock content %} {% block more_links %} <a href="{% url 'guest:login' %}">Login</a> <a href="{% url 'guest:register' %}">Register</a> {% endblock more_links %} |
- Create template for the bookings in Hostel Management System in Django.
In this section, we will learn on how create a templates for the bookings. To start with, add the following code in your bookings.html under the folder of guest/templates/guest files.
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
{% extends 'guest/base.html' %} {% block design %} .s_book{ padding: 30px; text-align: center; color: red ; } table.test td.test { background-color: lime; margin: 12px 12px 12px 12px; padding: 12px 12px 12px 12px; } table.test { border-collapse: separate; border-spacing: 10px; *border-collapse: expression('separate', cellSpacing = '10px'); } {% endblock design %} {% block content %} {% if bookings.count == 0 %} <center><h4 class = 's_book'> No Bookings Done!!</h4></center> {% else %} <center> <h3 class = 's_book'> ALL Successful Bookings of {{guest.first_name}} {{guest.last_name}} ({{guest.user.username}})</h3></center> <div class="wrapper" style=" padding-top: 0px;"> <div class="table"> <div class="row header"> <div class="cell"> ID </div> <div class="cell"> Room No </div> <div class="cell"> CheckIn </div> <div class="cell"> CheckOut </div> <div class="cell"> Status </div> <div class="cell"> Cancel </div> </div> {% for booking in bookings %} <div class="row"> <div class="cell" data-title="Number"> {{forloop.counter}} </div> <div class="cell" data-title="Number"> {{booking.room.no}} </div> <div class="cell" data-title="Date"> {{booking.checkIn}} </div> <div class="cell" data-title="Date"> {{booking.checkOut}} </div> <div class="cell" style="{% if booking.accept %} color: green {% elif booking.reject %} color:Red {% else %} color: blue {% endif %}" data-title="status"> {% if booking.accept %} Accepted {% elif booking.reject %} Rejected {% else %} Pending {% endif %} </div> <div class="cell"> {% if booking.accept %} <a class="btn btn-danger" href="{% url 'guest:cancel' booking.booking_id %}"> Cancel Booking </a> {% elif booking.reject %} Already Rejected {% else %} <a class="btn btn-danger" href="{% url 'guest:cancel' booking.booking_id %}"> Cancel Booking </a> {% endif %} </div> </div> {% endfor %} </div> </div> <br> {% endif %} {% endblock content %} {% block more_links %} <a href="{% url 'guest:home' %}"> Book A Room! </a> <a href="{% url 'guest:logout' %}">Logout</a> {% endblock more_links %} |
- Create template for the invoice in Hostel Management System in Django
In this section, we will learn on how create a templates for the invoice. To start with, add the following code in your invoice.html under the folder of guest/templates/guest files.
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Booking</title> </head> <body> <table> <tr> <td> First Name </td> <td> {{ res.guest.first_name }} </td> </tr> <tr> <td> Last Name </td> <td> {{ res.guest.last_name}} </td> </tr> <tr> <td> Phone no </td> <td> {{ res.guest.phone }} </td> </tr> <tr> <td> E-Mail </td> <td> {{ res.guest.email }} </td> </tr> <tr > <td> city </td> <td> {{ res.guest.city }} </td> </tr> <tr> <td> Room No.. </td> <td> {{ res.room.no }} in Guest House </td> </tr> <tr> <td> CheckIn </td> <td> {{ res.checkIn }} </td> </tr> <tr> <td> CheckOut </td> <td> {{ res.checkOut }} </td> </tr> </table> <br> <br> </body> </html> |
- Create template for the profile in Hostel Management System in Django.
In this section, we will learn on how create a templates for the profile. To start with, add the following code in your base.html under the folder of guest/templates/guest files.
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
{% extends 'guest/base.html' %} {% block content %} <div class="wrapper"> <div class="table"> <div class="row"> <div class="cell"> First Name </div> <div class="cell"> {{ res.guest.first_name }} </div> </div> <div class="row"> <div class="cell"> Last Name </div> <div class="cell"> {{ res.guest.last_name}} </div> </div> <div class="row"> <div class="cell"> Phone no </div> <div class="cell"> {{ res.guest.phone }} </div> </div> <div class="row"> <div class="cell"> E-Mail </div> <div class="cell"> {{ res.guest.email }} </div> </div> <div class="row"> <div class="cell"> city </div> <div class="cell"> {{ res.guest.city }} </div> </div> <div class="row"> <div class="cell"> Room </div> <div class="cell"> {{ res.room.no }} in Guest House </div> </div> <div class="row"> <div class="cell"> Price (&#x20b9;) </div> <div class="cell"> {{res.room.price}} </div> </div> <div class="row"> <div class="cell"> CheckIn </div> <div class="cell"> {{ res.checkIn }} </div> </div> <div class="row"> <div class="cell"> CheckOut </div> <div class="cell"> {{ res.checkOut }} </div> </div> </div> </div> <div style=" margin: 0 auto; padding: 40px; max-width: 800px;text-align:center;"> <a class="btn btn-success" href="{% url 'guest:confirm' res.booking_id %}"> Confirm Booking </a> <a class="btn btn-danger" href="{% url 'guest:cancel' res.booking_id %}"> Cancel Booking </a> <!--<a class="btn btn-success" href="{% url 'guest:pdf' res.booking_id %}"> Generate PDF </a>--> </div> {% endblock content %} {% block more_links %} <a href="{% url 'guest:logout' %}">Logout</a> {% endblock more_links %} |
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 Hostel Management System in Django with Source Code?
1st Step: Extract/unzip the file
2nd Step: Go inside the project folder, open cmd and type the following commands to install Django Framework and run the webserver:
- pip install -r requirements.txt
- python manage.py runserver
3rd Step: Finally, open the browser and go to http://127.0.0.1:8000/
Summary
In summary, this 2021 Hostel Management System in Django with Source Code can be useful to students or professional who wants to learn python django 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
Inquiries
If you have any questions or suggestions about Hostel Management System in Django with Source Code, please feel free to leave a comment below.