Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CSCI 41 Project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patricia Isabella Nava
CSCI 41 Project
Commits
a84dc1b9
Commit
a84dc1b9
authored
Dec 01, 2022
by
Patricia Isabella Nava
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: test if detail view is working with new url routing
parent
36c1cd6e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
6 deletions
+31
-6
detail.html
MagisAir/booking/templates/booking/detail.html
+20
-0
urls.py
MagisAir/booking/urls.py
+2
-2
views.py
MagisAir/booking/views.py
+9
-4
No files found.
MagisAir/booking/templates/booking/detail.html
0 → 100644
View file @
a84dc1b9
{% extends "booking/base.html" %}
{% load static %}
{% block content %}
<h1>
Booking Details
</h1>
<h1>
Passenger Information
</h1>
<p>
Passenger ID: {{booking.passenger.P_ID}}
<br>
Passenger Name: {{booking.passenger.First_Name}} {{booking.passenger.Middle_Initial}} {{booking.passenger.Last_Name}}
<br>
{{booking.passenger.P_ID}}
</p>
{% endblock %}
\ No newline at end of file
MagisAir/booking/urls.py
View file @
a84dc1b9
...
@@ -4,7 +4,7 @@ from .views import TravelHistoryView
...
@@ -4,7 +4,7 @@ from .views import TravelHistoryView
urlpatterns
=
[
urlpatterns
=
[
path
(
""
,
TravelHistoryView
.
as_view
(),
name
=
"index"
),
path
(
""
,
TravelHistoryView
.
as_view
(),
name
=
"index"
),
#booking/1
#booking/1
/details
path
(
"<int:
Booking_ID>
/"
,
views
.
detail
,
name
=
"detail"
),
path
(
"<int:
booking_id>/details
/"
,
views
.
detail
,
name
=
"detail"
),
]
]
\ No newline at end of file
MagisAir/booking/views.py
View file @
a84dc1b9
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.http
import
Http404
from
django.shortcuts
import
render
,
redirect
from
django.shortcuts
import
render
,
redirect
from
.models
import
Booking
from
.models
import
Booking
,
Passenger
from
django.views
import
View
from
django.views
import
View
# Create your views here.
# Create your views here.
...
@@ -15,6 +16,10 @@ class TravelHistoryView(View):
...
@@ -15,6 +16,10 @@ class TravelHistoryView(View):
return
render
(
request
,
'booking/index.html'
,
context
)
return
render
(
request
,
'booking/index.html'
,
context
)
def
detail
(
request
,
Booking_ID
):
def
detail
(
request
,
booking_id
=
None
):
response
=
"This is Booking #
%
s. This will show exact booking details of passenger"
try
:
return
HttpResponse
(
response
%
Booking_ID
)
booking
=
Booking
.
objects
.
get
(
pk
=
booking_id
)
\ No newline at end of file
except
Booking
.
DoesNotExist
:
raise
Http404
(
"Booking does not exist!"
)
return
render
(
request
,
"booking/detail.html"
,
{
"booking"
:
booking
})
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment