Commit 94f0d60c authored by Julia Santos's avatar Julia Santos

Users can now view all items marked as To Buy

parent 2c6e3121
......@@ -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, ItemViewPDate, add_item, delete_item
from .views import ProductListViewName, ProductListViewCategory, add_product_type, delete_product_type, ItemViewPDate, add_item, delete_item, ToBuyViewName
urlpatterns = [
url(r'^fridge/list/', ProductListViewName.as_view(), name='fridgeLN'),
......@@ -16,7 +16,8 @@ urlpatterns = [
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'),
path('fridge/<id>/add', add_item, name = 'add-item'),
path('fridge/<id>/<id2>/delete', delete_item, name = 'delete-item')
path('fridge/<id>/<id2>/delete', delete_item, name = 'delete-item'),
url(r'^to-buy/', ToBuyViewName.as_view(), name = 'to-buyLN')
]
if settings.DEBUG:
......
......@@ -32,6 +32,14 @@ class ProductListViewCategory(ListView):
def get_queryset(self):
return Product_Type.objects.filter(User_ID=self.request.user).order_by('Product_Category')
class ToBuyViewName(ListView):
model = Product_Type
template_name = 'placeholder-list.html'
context_object_name = 'product'
def get_queryset(self):
return Product_Type.objects.filter(User_ID=self.request.user).filter(To_Buy = True).order_by('Product_Name')
def login(request):
username = "not logged in"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment