Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
Hunger Buster - Breadcrumbs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
Julia Santos
Hunger Buster - Breadcrumbs
Commits
ad9dcc73
Commit
ad9dcc73
authored
Mar 17, 2021
by
Julia Santos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Individual items now display when clicking on Product
parent
66990953
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
117 additions
and
22 deletions
+117
-22
placeholder-items.html
Breadcrumbs/templates/placeholder-items.html
+87
-0
placeholder-list.html
Breadcrumbs/templates/placeholder-list.html
+2
-1
urls.py
Breadcrumbs/urls.py
+2
-1
views.py
Breadcrumbs/views.py
+17
-11
mainFridgeList.css
HTML and CSS Files/mainFridgeList.css
+9
-9
milk_ew30oGy.png
media/upload/milk_ew30oGy.png
+0
-0
No files found.
Breadcrumbs/templates/placeholder-items.html
0 → 100644
View file @
ad9dcc73
<html>
<title>
Fridge
</title>
{% load static %}
<link
rel=
"stylesheet"
href=
"{%static "
sidebar
.
css
"
%}"
>
{% block content %}
<style>
table
,
th
,
td
{
border
:
1px
solid
black
;
}
</style>
<div
class =
"listViewHeader"
>
<div
class =
"breadcrumbsHead"
>
BREADCRUMBS
</div>
</div>
<div
class =
"lowerPage"
>
<div
class =
"sidebar"
>
<div
class =
"sideItem text fridge"
>
FRIDGE
</div>
<div
class =
"sideItem icon fridge"
>
<div
class =
"circle"
>
:3
</div>
</div>
<div
class =
"sideItem text recipes"
>
RECIPES
</div>
<div
class =
"sideItem icon recipes"
>
<div
class =
"circle"
>
:3
</div>
</div>
<div
class =
"sideItem text stats"
>
STATS
</div>
<div
class =
"sideItem icon stats"
>
<div
class =
"circle"
>
:3
</div>
</div>
<div
class =
"sideItem text toBuy"
>
TO BUY
</div>
<div
class =
"sideItem icon toBuy"
>
<div
class =
"circle"
>
:3
</div>
</div>
</div>
</div>
<h2>
Fridge
</h2>
<table
style=
"width:70%"
div
class=
"main"
>
<tr><th
colspan=
"5"
><a
href=
"http://127.0.0.1:8000/fridge/add/"
>
Add Item
</a></th></tr>
<tr><th></th>
<th><a
href=
"http://127.0.0.1:8000/fridge{{object_list.Product_ID}}"
>
Name
</a></th>
<th><a
href=
"http://127.0.0.1:8000/fridge/{{object_list.Product_ID}}"
>
Description
</a></th>
<th>
Quantity
</th>
<th>
Expiration Date
</th>
<th>
Purchase Date
</th>
<th>
Status
</th>
</tr>
{% for item in object_list %}
<tr>
<th>
{{item.Product_ID.Product_Name}}
</th>
<th>
{{item.Item_Description}}
</th>
<th>
{{item.Item_Quantity}} {{item.Quantity_Unit}}
</th>
<th>
{{item.Expiration_Date}}
</th>
<th>
{{item.Purchase_Date}}
</th>
<th>
{{item.Is_Expired}}
</th>
<th>
<a
href=
'http://127.0.0.1:8000/fridge/{{item.Item_ID}}/delete'
>
Delete?
</a>
</th>
</tr>
{% endfor %}
</table>
{% endblock %}
</html>
Breadcrumbs/templates/placeholder-list.html
View file @
ad9dcc73
...
...
@@ -62,7 +62,8 @@
<img
src =
"{{product.Icon.url}}"
width =
"100"
height =
"100"
>
</th>
<th>
{{product.Product_Name}}
<a
href=
'http://127.0.0.1:8000/fridge/{{product.Product_ID}}'
>
{{product.Product_Name}}
</a>
</th>
<th>
{{product.Product_Category}}
...
...
Breadcrumbs/urls.py
View file @
ad9dcc73
...
...
@@ -4,7 +4,7 @@ from django.conf.urls.static import static
from
django.views.generic
import
TemplateView
from
django.urls
import
include
,
path
from
Breadcrumbs
import
views
from
.views
import
ProductListViewName
,
ProductListViewCategory
,
add_product_type
,
delete_product_type
#ProductTypeDeleteView
from
.views
import
ProductListViewName
,
ProductListViewCategory
,
add_product_type
,
delete_product_type
,
ItemViewPDate
#item_view_by_pdate
urlpatterns
=
[
url
(
r'^fridge/list/'
,
ProductListViewName
.
as_view
(),
name
=
'fridgeLN'
),
...
...
@@ -14,6 +14,7 @@ urlpatterns = [
path
(
'fridge/add/'
,
add_product_type
,
name
=
'product-type-form'
),
#path('fridge/<pk>/delete', ProductTypeDeleteView.as_view()),
path
(
'fridge/<id>/delete'
,
delete_product_type
,
name
=
'product-type-delete'
),
url
(
r'^fridge/(?P<Product_ID>\d+)/$'
,
ItemViewPDate
.
as_view
(),
name
=
'item-purchase-date-view'
)
]
if
settings
.
DEBUG
:
...
...
Breadcrumbs/views.py
View file @
ad9dcc73
...
...
@@ -2,7 +2,7 @@ from django.views.generic import ListView
from
django.db.models
import
Q
from
.forms
import
LoginForm
,
ProductTypeForm
from
django.http
import
HttpResponseRedirect
from
django.shortcuts
import
render
,
get_object_or_404
from
django.shortcuts
import
render
,
get_object_or_404
#, render_to_response
from
django.forms
import
ValidationError
from
django.views.generic.edit
import
DeleteView
...
...
@@ -83,15 +83,21 @@ def delete_product_type(request,id):
obj
.
delete
()
return
HttpResponseRedirect
(
"/fridge/list/"
)
return
render
(
request
,
'product-type-confirm-delete.html'
,
context
)
return
render
(
request
,
'product-type-confirm-delete.html'
,
context
)
# class ProductTypeDeleteView(Delete
View):
# models = Product_Type
# template_name = 'product-type-confirm-delete
.html'
# success_url = 'fridge/list/
'
class
ItemViewPDate
(
List
View
):
model
=
Item
template_name
=
'placeholder-items
.html'
context_object_name
=
'item
'
# def get_object(self, queryset=None):
# obj = super(ProductTypeDeleteView, self).get_object()
# if not obj.owner == self.request.user:
# raise Http404
# return obj
\ No newline at end of file
def
get_queryset
(
self
,
**
kwargs
):
return
Item
.
objects
.
filter
(
User_ID
=
self
.
request
.
user
)
.
order_by
(
'Purchase_Date'
)
.
filter
(
Product_ID
=
self
.
kwargs
[
'Product_ID'
])
#def get_queryset(self, **kwargs):
# return Item.objects.filter(User_ID=self.request.user).order_by('Purchase_Date').filter(Product_ID=)
# def get_context_data(self, **kwargs):
# return Item.objects.filter(User_ID=self.request.user).get(Product_ID=kwargs['Product_ID'])
#def item_view_by_pdate(request, Product_ID):
# items = Item.objects.filter(User_ID = self.request.user).filter(Product_ID= Product_ID)
# context = items
# return render(request,'placeholder-items.html',items)
\ No newline at end of file
HTML and CSS Files/mainFridgeList.css
View file @
ad9dcc73
media/upload/milk_ew30oGy.png
0 → 100644
View file @
ad9dcc73
19.4 KB
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