A Simple Hostel Booking Portal Based On Django2.0 With Custom Admin Page.
- Download the zip file and extract it to a new folder.
- Open terminal and navigate to the folder which contains
manage.py
file by running the commandcd Hostel-Booking-Portal-master
. - Create a new virtual environment:
virtualenv venv
. - Activate the virtual environment:
source ./venv/bin/activate
. - Install the dependencies:
pip install -r requirements.txt
. - Create the database:
python manage.py migrate --run-syncdb
. - Create super user:
python manage.py createsuperuser
and then enterusername
,email
, andpassword
for the super user. - Collect the static files:
python manage.py collectstatic
. (NOTE: This will create a folder namedstatic_cdn
on the base directory of the directory wheremanage.py
is located. To change this edit theMEDIA_ROOT
in theVHBooking_Portal/settings.py
. And then runpython manage.py collectstatic
.) - Run the server:
python manage.py runserver
.
-
Run the server:
python manage.py runserver
. -
Navigate to
http://localhost:8000/admin/
. -
Login with the username and password for super user.
-
Under the
HOSTEL
section, click onHostels
and then click onADD HOSTEL
button on the top right. -
Enter the name of the hostel (for eg. VH1) and then fill the other fields according to the below table:
Field What it represents Total rooms Total numbers of rooms the hostel have Total available rooms Total rooms which are, at present, available for booking Total booked rooms Total rooms which are already booked -
Click on Save.
-
Open the file
hostel/util.py
and add your hostel under the functiongenerate_choices_of_hostels
there in the tuple with the corresponding serial number. -
Save the file.
-
Open the file
visitor/util.py
. -
Edit the list on
line 23
with the names of your hostel. -
Save the file.
- Open the file:
userAuthentication/pipeline.py
. - Edit the conditions which checks the email in the function
check_email
online 8
to allow/disallow different email domains to login.
- Open The File
visitor/models.py
. - Edit the tuple according to your needs. For eg.
ROOM_TYPES = (
('AC', 'AC'),
('NON AC', 'NON AC'),
)
- Open file
VHBooking_Portal/settings.py
and navigate toline 166
. - Enter your Client ID for Google Web Application for the field
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY
. - On
line 167
, Enter your Secret Key for Google Web Application for the fieldSOCIAL_AUTH_GOOGLE_OAUTH2_SECRET
. - A guide about this can be found here : Simple Google Authentication in Django
- All templates files are there in the folder
templates
located at the same level wheremanage.py
file is located, edit those files according to your needs.
- Navigate to
http://localhost:8000/admin/
and login with super user credentials. - Under
AUTHENTICATION AND AUTHORIZATION
section, click onUsers
. - Select a user with its username.
- Under the
Permissions
section, selectStaff status
and then click on Save. - Now this user will be redirected automatically to the admin page when it logins via google.