feat: create new view for booking detail and link corresponding url

Allow for user to be redirected to new screen when they click
the row for booking id to see more details.
Additional chore: Push to repo modified settings.py to encrypt .env
parent 1ec46f40
......@@ -11,6 +11,10 @@ https://docs.djangoproject.com/en/3.2/ref/settings/
"""
from pathlib import Path
from dotenv import load_dotenv
import os
load_dotenv()
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
......@@ -20,7 +24,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-o9+x6b*o&r$#j#a_qe8d(n%xunjeyvt)dsnnt&mqtk^)dvzhbk'
SECRET_KEY = os.getenv('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
......
......@@ -2,5 +2,8 @@ from django.urls import path
from . import views
urlpatterns = [
path("", views.index, name="index")
path("", views.index, name="index"),
#booking/1
path("<int:Booking_ID>/", views.detail, name="detail"),
]
\ No newline at end of file
from django.http import HttpResponse
from .models import Booking
# Create your views here.
def index(request):
return HttpResponse("booking index")
def detail(request, Booking_ID):
response = "This is Booking # %s. This will show exact booking details of passenger"
return HttpResponse(response %Booking_ID)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment