Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
warpinfra
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
infrastruktur
warpinfra
Commits
52bf8ec5
Commit
52bf8ec5
authored
8 years ago
by
Christian Dresen
Browse files
Options
Downloads
Patches
Plain Diff
[WarpFood] Add orders to database
parent
79c1c90d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
www/web/warpfood/templates/warpfood/view.html
+1
-1
1 addition, 1 deletion
www/web/warpfood/templates/warpfood/view.html
www/web/warpfood/views.py
+12
-2
12 additions, 2 deletions
www/web/warpfood/views.py
with
13 additions
and
3 deletions
www/web/warpfood/templates/warpfood/view.html
+
1
−
1
View file @
52bf8ec5
...
...
@@ -137,7 +137,7 @@
<div
class=
"tab-content"
>
{% for category,products in food_products.items %}
<div
role=
"tabpanel"
class=
"tab-pane fade in{% if category == "
Pizza
"
%}
active
{%
endif
%}"
id=
"{{ category }}"
>
<div
role=
"tabpanel"
class=
"tab-pane fade in{% if category == "
all
"
%}
active
{%
endif
%}"
id=
"{{ category }}"
>
<table
class=
"table table-striped table-hover"
>
{% for product in products %}
<tr
data-link=
"javascript:choose_food_product('{{ product.name }}','{{ product.size }}','{{ product.price }}', '{{ product.id }}');"
>
...
...
This diff is collapsed.
Click to expand it.
www/web/warpfood/views.py
+
12
−
2
View file @
52bf8ec5
...
...
@@ -51,7 +51,6 @@ def edit_sheet(request, sheet_id=0):
return
redirect
(
"
/
"
)
def
view
(
request
,
sheet_id
=
0
):
form
=
None
page_context
[
'
error
'
]
=
""
...
...
@@ -61,7 +60,15 @@ def view(request, sheet_id=0):
else
:
form
=
FoodOrderFormExt
(
request
.
POST
)
if
form
.
is_valid
():
form
.
save
()
order
=
form
.
save
()
if
not
order
.
product_id
:
p
=
FoodProduct
()
p
.
name
=
order
.
article
p
.
food_service
=
order
.
sheet
.
food_service
p
.
food_category
=
FoodCategory
.
objects
.
get
(
name
=
"
not_assigned
"
)
p
.
size
=
order
.
size
p
.
price
=
order
.
price
p
.
save
()
form
=
None
if
sheet_id
!=
0
:
...
...
@@ -83,11 +90,14 @@ def view(request, sheet_id=0):
products
=
FoodProduct
.
objects
.
filter
(
food_service
=
sheet
.
food_service
)
page_context
[
'
food_products
'
]
=
{}
page_context
[
'
food_products
'
][
'
all
'
]
=
[]
for
product
in
products
:
if
product
.
food_category
.
name
not
in
page_context
[
'
food_products
'
]:
page_context
[
'
food_products
'
][
product
.
food_category
.
name
]
=
[]
page_context
[
'
food_products
'
][
'
all
'
].
append
(
product
)
page_context
[
'
food_products
'
][
product
.
food_category
.
name
].
append
(
product
)
return
HttpResponse
(
render
(
request
,
'
warpfood/view.html
'
,
page_context
))
...
...
This diff is collapsed.
Click to expand it.
Christian Dresen
@dray
mentioned in issue
#6 (closed)
·
8 years ago
mentioned in issue
#6 (closed)
mentioned in issue #6
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment