From 79b3e4f1681a3bd185bab9b9b9d51a6685df6baf Mon Sep 17 00:00:00 2001
From: Lukas Schneider <lukas.s.schneider@fau.de>
Date: Wed, 25 Sep 2019 09:38:12 +0200
Subject: [PATCH] Update views to pass data with the new data model to the buy
 template

---
 store/views.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/store/views.py b/store/views.py
index 3d59ecc..9806f5c 100644
--- a/store/views.py
+++ b/store/views.py
@@ -1,5 +1,5 @@
 from django.shortcuts import render, reverse
-from .models import User, Product, UserIdentifierTypes
+from .models import User, Product, UserIdentifierTypes, ProductIdentifierTypes
 from django.views.decorators.http import require_http_methods
 from django.views.decorators.csrf import csrf_protect
 from django.contrib.auth.decorators import login_required
@@ -35,9 +35,10 @@ def buy(request):
         return render(request, "buy.html", {
             "most_bought": ProductLogic.getMostBoughtProductsList(),
             "recently_bought": ProductLogic.getLastBoughtProductsList(request.user.id),
-            "drinks": Product.objects.filter(category="drink").order_by('name'),
-            "candies": Product.objects.filter(category="candy").order_by('name'),
+            "drinks": ProductLogic.getDrinks(),
+            "candies": ProductLogic.getCandies(),
             "products": Product.objects.all(),
+            "ident_types": ProductIdentifierTypes.to_dict(),
         })
     elif request.method == 'POST':  # Perform a purchase
         user_id = request.user.id
-- 
GitLab