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
62511dca
Commit
62511dca
authored
Dec 01, 2022
by
Patricia Isabella Nava
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: change view of index to CBV to allow use of templates for HTML use
parent
c14d0c68
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
3 deletions
+31
-3
base.html
MagisAir/booking/templates/booking/base.html
+1
-0
index.html
MagisAir/booking/templates/booking/index.html
+17
-0
urls.py
MagisAir/booking/urls.py
+2
-1
views.py
MagisAir/booking/views.py
+11
-2
No files found.
MagisAir/booking/templates/booking/base.html
0 → 100644
View file @
62511dca
{% load static %} {% block content %} {% endblock %}
\ No newline at end of file
MagisAir/booking/templates/booking/index.html
0 → 100644
View file @
62511dca
{% extends "booking/base.html" %}
{% block content %}
<h1>
Travel History
</h1>
<p>
All Bookings:
<br>
{% for booking in bookings_list %}
<ul>
</ul>
{% endfor %}
</p>
{% endblock %}
MagisAir/booking/urls.py
View file @
62511dca
from
django.urls
import
path
from
.
import
views
from
.views
import
TravelHistoryView
urlpatterns
=
[
path
(
""
,
views
.
index
,
name
=
"index"
),
path
(
""
,
TravelHistoryView
.
as_view
()
,
name
=
"index"
),
#booking/1
path
(
"<int:Booking_ID>/"
,
views
.
detail
,
name
=
"detail"
),
...
...
MagisAir/booking/views.py
View file @
62511dca
from
django.http
import
HttpResponse
from
django.shortcuts
import
render
,
redirect
from
.models
import
Booking
from
django.views
import
View
# Create your views here.
def
index
(
request
):
return
HttpResponse
(
"booking index"
)
class
TravelHistoryView
(
View
):
def
get
(
self
,
request
):
bookings_list
=
Booking
.
objects
.
order_by
(
"Booking_Date"
)
context
=
{
'bookings_list'
:
bookings_list
}
return
render
(
request
,
'booking/index.html'
,
context
)
def
detail
(
request
,
Booking_ID
):
response
=
"This is Booking #
%
s. This will show exact booking details of passenger"
...
...
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