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
797967f9
Commit
797967f9
authored
Dec 15, 2021
by
Martina Therese R. Reyes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created Migrations. Cleaned views python file.
parent
cce212e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
157 additions
and
11 deletions
+157
-11
0002_baseflavor_customer_ingredient_item_orders_size.py
...s/0002_baseflavor_customer_ingredient_item_orders_size.py
+83
-0
models.py
main/models.py
+73
-3
views.py
main/views.py
+1
-8
No files found.
main/migrations/0002_baseflavor_customer_ingredient_item_orders_size.py
0 → 100644
View file @
797967f9
# Generated by Django 4.0 on 2021-12-15 03:27
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'main'
,
'0001_initial'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'BaseFlavor'
,
fields
=
[
(
'bf_id'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'bf_name'
,
models
.
CharField
(
max_length
=
255
)),
],
options
=
{
'db_table'
:
'base_flavor'
,
'managed'
:
False
,
},
),
migrations
.
CreateModel
(
name
=
'Customer'
,
fields
=
[
(
'customer_id'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'customer_name'
,
models
.
CharField
(
max_length
=
255
)),
],
options
=
{
'db_table'
:
'customer'
,
'managed'
:
False
,
},
),
migrations
.
CreateModel
(
name
=
'Ingredient'
,
fields
=
[
(
'ingredient_id'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'ingredient_name'
,
models
.
CharField
(
max_length
=
255
)),
(
'quantity'
,
models
.
IntegerField
()),
(
'price_per_serving'
,
models
.
FloatField
()),
(
'replenished_stock'
,
models
.
CharField
(
choices
=
[(
'Y'
,
'Y'
),
(
'N'
,
'N'
)],
max_length
=
1
)),
],
options
=
{
'db_table'
:
'ingredient'
,
'managed'
:
False
,
},
),
migrations
.
CreateModel
(
name
=
'Item'
,
fields
=
[
(
'item_id'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'io_quantity'
,
models
.
IntegerField
()),
(
'total_sales'
,
models
.
FloatField
()),
],
options
=
{
'db_table'
:
'item'
,
'managed'
:
False
,
},
),
migrations
.
CreateModel
(
name
=
'Orders'
,
fields
=
[
(
'order_id'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'order_date'
,
models
.
DateField
()),
],
options
=
{
'db_table'
:
'orders'
,
'managed'
:
False
,
},
),
migrations
.
CreateModel
(
name
=
'Size'
,
fields
=
[
(
'size_id'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'serv_size'
,
models
.
CharField
(
choices
=
[(
'8'
,
'8'
),
(
'12'
,
'12'
),
(
'16'
,
'16'
)],
max_length
=
2
)),
],
options
=
{
'db_table'
:
'size'
,
'managed'
:
False
,
},
),
]
main/models.py
View file @
797967f9
...
...
@@ -6,12 +6,60 @@
# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table
# Feel free to rename the models, but don't rename db_table values or field names.
from
django.db
import
models
from
django.db.models.fields
import
*
class
BaseFlavor
(
models
.
Model
):
bf_id
=
models
.
AutoField
(
primary_key
=
True
)
bf_name
=
models
.
CharField
(
max_length
=
255
)
class
Meta
:
managed
=
False
db_table
=
'base_flavor'
class
Customer
(
models
.
Model
):
customer_id
=
models
.
AutoField
(
primary_key
=
True
)
customer_name
=
models
.
CharField
(
max_length
=
255
)
class
Meta
:
managed
=
False
db_table
=
'customer'
class
Ingredient
(
models
.
Model
):
REPLENISHED_STOCK
=
[
(
'Y'
,
'Y'
),
(
'N'
,
'N'
),
]
ingredient_id
=
models
.
AutoField
(
primary_key
=
True
)
ingredient_name
=
models
.
CharField
(
max_length
=
255
)
quantity
=
models
.
IntegerField
()
price_per_serving
=
models
.
FloatField
()
replenished_stock
=
models
.
CharField
(
max_length
=
1
,
choices
=
REPLENISHED_STOCK
)
class
Meta
:
managed
=
False
db_table
=
'ingredient'
class
Size
(
models
.
Model
):
SIZES
=
[
(
'8'
,
'8'
),
(
'12'
,
'12'
),
(
'16'
,
'16'
),
]
size_id
=
models
.
AutoField
(
primary_key
=
True
)
serv_size
=
models
.
CharField
(
max_length
=
2
,
choices
=
SIZES
)
class
Meta
:
managed
=
False
db_table
=
'size'
class
Employee
(
models
.
Model
):
employee_id
=
models
.
IntegerField
(
primary_key
=
True
)
employee_name
=
models
.
CharField
(
max_length
=
255
)
def
__str__
(
self
):
return
self
.
employee_name
class
Meta
:
managed
=
False
db_table
=
'employee'
...
...
@@ -36,11 +84,33 @@ class EmployeeRole(models.Model):
role_description
=
models
.
CharField
(
max_length
=
20
,
choices
=
ROLES
)
is_manager
=
models
.
CharField
(
max_length
=
1
,
choices
=
IS_MANAGER
)
def
employeename
(
self
):
return
self
.
employee
.
employee_name
def
__str__
(
self
):
return
self
.
employee
.
employee_name
+
" is tasked for "
+
self
.
role_description
class
Meta
:
managed
=
False
db_table
=
'employeerole'
class
Item
(
models
.
Model
):
item_id
=
models
.
AutoField
(
primary_key
=
True
)
bf
=
models
.
ForeignKey
(
BaseFlavor
,
models
.
DO_NOTHING
)
ingredient
=
models
.
ForeignKey
(
Ingredient
,
models
.
DO_NOTHING
)
size
=
models
.
ForeignKey
(
Size
,
models
.
DO_NOTHING
)
io_quantity
=
models
.
IntegerField
()
total_sales
=
models
.
FloatField
()
def
ingredientname
(
self
):
return
self
.
ingredient
.
ingredient_name
,
self
.
size
.
serv_size
,
self
.
bf
.
bf_name
class
Meta
:
managed
=
False
db_table
=
'item'
class
Orders
(
models
.
Model
):
order_id
=
models
.
AutoField
(
primary_key
=
True
)
customer_id
=
models
.
ForeignKey
(
Customer
,
models
.
DO_NOTHING
)
item_id
=
models
.
ForeignKey
(
Item
,
models
.
DO_NOTHING
)
employee_id
=
models
.
ForeignKey
(
Employee
,
models
.
DO_NOTHING
)
order_date
=
models
.
DateField
()
class
Meta
:
managed
=
False
db_table
=
'orders'
\ No newline at end of file
main/views.py
View file @
797967f9
...
...
@@ -33,15 +33,11 @@ def schedule(request):
)
# 1: FILTER EMPLOYEES BY MANAGER FOR THE DAY - mate
def
manager_query
(
request
):
ismanager_query
=
EmployeeRole
.
objects
.
all
()
.
filter
(
is_manager
=
'Y'
)
return
render
(
request
,
"blizzardblast/templates/queries/manager_query.html"
,
{
'manager'
:
ismanager_query
})
# 3 : FILTER BY WEEK - dedz
def
week_query
(
request
):
week_query1
=
EmployeeRole
.
objects
.
all
()
.
filter
(
role_date__range
=
[
"2025-09-01"
,
"2025-09-06"
])
.
order_by
(
'role_date'
)
...
...
@@ -53,8 +49,6 @@ def week_query(request):
)
# 4: FILTER EMPLOYEES BY ROLES - xtine
def
role_query
(
request
):
role_query1
=
EmployeeRole
.
objects
.
all
()
.
filter
(
role_description
=
'Cashier'
)
role_query2
=
EmployeeRole
.
objects
.
all
()
.
filter
(
role_description
=
'Preparation'
)
...
...
@@ -64,9 +58,8 @@ def role_query(request):
}
)
# 2: FILTER EMPLOYEES IN ALPHABETICAL ORDER - felizia
def
alphabetical_query
(
request
):
# 2: FILTER EMPLOYEES IN ALPHABETICAL ORDER - felizia
alphabetical_query
=
EmployeeRole
.
objects
.
order_by
(
'employee__employee_name'
)
for
i
in
alphabetical_query
:
...
...
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