Commit fdf55220 authored by Julia Santos's avatar Julia Santos

Merge branch 'master' of...

Merge branch 'master' of https://gitlab.discs.ateneo.edu/JJSantos/hunger-buster---breadcrumbs into adaptHTML
parents cf3b8de1 393a2df7
...@@ -4,7 +4,7 @@ from django.conf.urls.static import static ...@@ -4,7 +4,7 @@ from django.conf.urls.static import static
from django.views.generic import TemplateView from django.views.generic import TemplateView
from django.urls import include, path from django.urls import include, path
from Breadcrumbs import views 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 = [ urlpatterns = [
url(r'^fridge/list/', ProductListViewName.as_view(), name='fridgeLN'), url(r'^fridge/list/', ProductListViewName.as_view(), name='fridgeLN'),
...@@ -14,7 +14,8 @@ urlpatterns = [ ...@@ -14,7 +14,8 @@ urlpatterns = [
path('fridge/<id>/delete', delete_product_type, name='product-type-delete'), 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'), 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>/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: if settings.DEBUG:
......
...@@ -40,7 +40,31 @@ class ProductListViewCategory(ListView): ...@@ -40,7 +40,31 @@ class ProductListViewCategory(ListView):
def get_queryset(self): def get_queryset(self):
return Product_Type.objects.filter(User_ID=self.request.user).order_by('Product_Category') 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"
if request.method =="POST":
MyLoginForm = LoginForm(request.POST)
if MyLoginForm.is_valid():
username = MyLoginForm.cleaned_data['username']
#return HttpResponseRedirect('/fridge/list')
else:
MyLoginForm = Loginform()
return render(request, loggedin.html,{"username" : username})
def add_product_type(request): def add_product_type(request):
context = {} context = {}
if request.method == 'POST': if request.method == 'POST':
......
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