Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
GrabGrub
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
Matthew Dominic M. Dizon
GrabGrub
Commits
f4c47c40
Commit
f4c47c40
authored
May 27, 2021
by
Matthew Dizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
formatted views.py
parent
e346d596
Pipeline
#1920
canceled with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
27 deletions
+23
-27
views.py
GrabGrub/Kiosk/views.py
+23
-27
No files found.
GrabGrub/Kiosk/views.py
View file @
f4c47c40
...
...
@@ -3,30 +3,6 @@ from .models import *
# Create your views here.
def
home
(
request
):
orders
=
Order
.
objects
.
all
()
context
=
{
"orders"
:
orders
}
return
render
(
request
,
'Kiosk/home.html'
,
context
)
def
view_order_details
(
request
,
pk
):
order
=
get_object_or_404
(
Order
,
pk
=
pk
)
context
=
{
"order"
:
order
}
# url = request.META.get('HTTP_REFERER')
# request.session['url'] = url
# print(url)
return
render
(
request
,
'Kiosk/view_order_details.html'
,
context
)
def
update_order
(
request
,
pk
):
if
(
request
.
method
==
"POST"
):
qty
=
request
.
POST
.
get
(
'qty'
)
payment_mode
=
request
.
POST
.
get
(
'payment_mode'
)
Order
.
objects
.
filter
(
pk
=
pk
)
.
update
(
qty
=
qty
,
payment_mode
=
payment_mode
)
return
redirect
(
'view_order_details'
,
pk
=
pk
)
else
:
order
=
get_object_or_404
(
Order
,
pk
=
pk
)
context
=
{
"order"
:
order
}
return
render
(
request
,
'Kiosk/update_order.html'
,
context
)
### Views for Account Model
def
login_view
(
request
):
if
request
.
method
==
"POST"
:
...
...
@@ -77,8 +53,28 @@ def signup_view(request):
def
logout_view
(
request
):
return
redirect
(
'/'
)
### Views for Order Model
def
home
(
request
):
orders
=
Order
.
objects
.
all
()
context
=
{
"orders"
:
orders
}
return
render
(
request
,
'Kiosk/home.html'
,
context
)
def
view_order_details
(
request
,
pk
):
order
=
get_object_or_404
(
Order
,
pk
=
pk
)
context
=
{
"order"
:
order
}
return
render
(
request
,
'Kiosk/view_order_details.html'
,
context
)
def
update_order
(
request
,
pk
):
if
(
request
.
method
==
"POST"
):
qty
=
request
.
POST
.
get
(
'qty'
)
payment_mode
=
request
.
POST
.
get
(
'payment_mode'
)
Order
.
objects
.
filter
(
pk
=
pk
)
.
update
(
qty
=
qty
,
payment_mode
=
payment_mode
)
return
redirect
(
'view_order_details'
,
pk
=
pk
)
else
:
order
=
get_object_or_404
(
Order
,
pk
=
pk
)
context
=
{
"order"
:
order
}
return
render
(
request
,
'Kiosk/update_order.html'
,
context
)
### Views for Food Model
### Views for Customer Model
\ No newline at end of file
### Views for Order Model
\ 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