Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Blizzard Blast
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
Martina Therese R. Reyes
Blizzard Blast
Commits
f3fc02b5
Commit
f3fc02b5
authored
Dec 15, 2021
by
Martina Therese R. Reyes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed the order.html according to the models.py file.
Adjusted views, forms and cleaned urls.py
parent
9561791c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
40 deletions
+51
-40
order.html
blizzardblast/templates/order.html
+9
-27
forms.py
main/forms.py
+13
-8
urls.py
main/urls.py
+8
-1
views.py
main/views.py
+21
-4
No files found.
blizzardblast/templates/order.html
View file @
f3fc02b5
{% extends 'blizzardblast\templates\base.html' %}
{% extends 'blizzardblast\templates\base.html' %}
{% load static %}
{% load static %}
{% block title %}
Create
Order{% endblock %}
{% block title %}Order{% endblock %}
{% block styles %}
{% block styles %}
{% endblock %}
{% endblock %}
...
@@ -31,39 +31,21 @@
...
@@ -31,39 +31,21 @@
<table>
<table>
<!-- TABLE HEADER -->
<!-- TABLE HEADER -->
<tr>
<tr>
<th>
customer_no
</th>
<th>
customer_name
</th>
<th>
customer_name
</th>
<th>
date
</th>
<th>
date
</th>
<th>
size
</th>
<th>
item
</th>
<th>
base_recipe
</th>
<th>
Employee in charge
</th>
<th>
add_on_qty
</th>
<th>
add_on_name
</th>
</tr>
</tr>
<!-- TABLE ROW WITH INFO -->
<!-- TABLE ROW WITH INFO -->
{% for order in orders%}
<tr>
<tr>
<td>
2039
</td>
<td>
{{order.customer}}
</td>
<td>
Anna Doe
</td>
<td>
{{order.order_date}}
</td>
<td>
11/13/15
</td>
<td>
{{order.item}}
</td>
<td>
12 oz
</td>
<td>
{{order.employee}}
</td>
<td>
base_receipe
</td>
<td>
1
</td>
<td>
mini marshmallows,
<br>
strawberry
</td>
</tr>
<!-- TABLE ROW WITHOUT INFO -->
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</tr>
{%endfor%}
</table>
</table>
</div>
</div>
...
...
main/forms.py
View file @
f3fc02b5
from
django
import
forms
from
django
import
forms
from
django.forms
import
(
ModelForm
,
TextInput
,
Textarea
,
widgets
)
from
.models
import
Customer
,
Orders
,
Item
class
AddOrderForm
(
forms
.
ModelForm
):
class
AddOrderForm
(
forms
.
Form
):
class
Meta
:
customer_no
=
forms
.
IntegerField
(
label
=
'Customer no'
)
model
=
Orders
customer_name
=
forms
.
CharField
(
label
=
'Customer Name'
,
max_length
=
50
)
fields
=
'__all__'
date
=
forms
.
DateField
(
label
=
'Date'
)
# customer_no = forms.IntegerField(label='Customer no')
base_recipe
=
forms
.
CharField
(
label
=
'Base Recipe'
)
# customer_name = forms.CharField(label='Customer Name', max_length=50)
add_on_qty
=
forms
.
IntegerField
(
label
=
'Add-on Qty'
)
# date = forms.DateField(label='Date')
add_on_name
=
forms
.
CharField
(
label
=
'Add-on'
)
# base_recipe = forms.CharField(label='Base Recipe')
# add_on_qty = forms.IntegerField(label='Add-on Qty')
# add_on_name = forms.CharField(label='Add-on')
INGREDIENT_CATEGORIES
=
(
INGREDIENT_CATEGORIES
=
(
(
1
,
'nuts'
),
(
1
,
'nuts'
),
...
...
main/urls.py
View file @
f3fc02b5
...
@@ -2,14 +2,21 @@ from django.urls import path, include
...
@@ -2,14 +2,21 @@ from django.urls import path, include
from
.views
import
*
from
.views
import
*
urlpatterns
=
[
urlpatterns
=
[
# main views
path
(
''
,
homepage
,
name
=
'homepage'
),
path
(
''
,
homepage
,
name
=
'homepage'
),
# order view
path
(
'order'
,
order
,
name
=
'order'
),
path
(
'order'
,
order
,
name
=
'order'
),
path
(
'receipt'
,
receipt
,
name
=
'receipt'
),
path
(
'inventory'
,
inventory
,
name
=
'inventory'
),
path
(
'inventory'
,
inventory
,
name
=
'inventory'
),
path
(
'schedule'
,
schedule
,
name
=
'schedule'
),
path
(
'schedule'
,
schedule
,
name
=
'schedule'
),
path
(
'report'
,
report
,
name
=
'report'
),
path
(
'report'
,
report
,
name
=
'report'
),
path
(
'receipt'
,
receipt
,
name
=
'receipt'
),
#forms
path
(
'addorder'
,
addorder
,
name
=
'addorder'
),
path
(
'addorder'
,
addorder
,
name
=
'addorder'
),
path
(
'addinventory'
,
addinventory
,
name
=
'addinventory'
),
path
(
'addinventory'
,
addinventory
,
name
=
'addinventory'
),
#queries
path
(
'manager_query'
,
manager_query
,
name
=
'manager_query'
),
path
(
'manager_query'
,
manager_query
,
name
=
'manager_query'
),
path
(
'week_query'
,
week_query
,
name
=
'week_query'
),
path
(
'week_query'
,
week_query
,
name
=
'week_query'
),
path
(
'role_query'
,
role_query
,
name
=
'role_query'
),
path
(
'role_query'
,
role_query
,
name
=
'role_query'
),
...
...
main/views.py
View file @
f3fc02b5
from
django.shortcuts
import
render
from
django.shortcuts
import
render
,
redirect
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.forms
import
AddInventoryForm
,
AddOrderForm
from
.forms
import
AddInventoryForm
,
AddOrderForm
from
.models
import
*
from
.models
import
*
def
homepage
(
request
):
def
homepage
(
request
):
return
render
(
request
,
"blizzardblast/templates/index.html"
)
return
render
(
request
,
"blizzardblast/templates/index.html"
)
def
order
(
request
):
def
order
(
request
):
return
render
(
request
,
"blizzardblast/templates/order.html"
)
orders_context
=
Orders
.
objects
.
all
()
return
render
(
request
,
"blizzardblast/templates/order.html"
,
{
'orders'
:
orders_context
})
def
receipt
(
request
):
def
receipt
(
request
):
...
@@ -74,11 +78,24 @@ def report(request):
...
@@ -74,11 +78,24 @@ def report(request):
return
render
(
request
,
"blizzardblast/templates/report.html"
)
return
render
(
request
,
"blizzardblast/templates/report.html"
)
# FORMS
def
addorder
(
request
):
def
addorder
(
request
):
form
=
AddOrderForm
()
form
=
AddOrderForm
()
return
render
(
request
,
"blizzardblast/templates/addorder.html"
,
{
'form'
:
form
})
context
=
{
'form'
:
form
}
if
request
.
method
==
'POST'
:
#print("Printing post: ", request.POST)
form
=
AddOrderForm
(
request
.
POST
)
if
form
.
is_valid
():
form
.
save
()
return
redirect
(
'/order'
)
return
render
(
request
,
"blizzardblast/templates/addorder.html"
,
context
)
def
addinventory
(
request
):
def
addinventory
(
request
):
form
=
AddInventoryForm
()
form
=
AddInventoryForm
()
return
render
(
request
,
"blizzardblast/templates/addinventory.html"
,
{
'
inventory_form'
:
form
})
return
render
(
request
,
"blizzardblast/templates/addinventory.html"
,
{
'
form'
:
form
})
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