Merge branch 'diego' into development

This commit is contained in:
Sam
2021-03-17 10:18:07 +00:00
2 changed files with 5 additions and 4 deletions

View File

@@ -161,7 +161,8 @@ def product_search(request):
discount = False
else:
discount = None
category = request.GET.get('category', None)
# category = request.GET.get('category', None)
category = request.query_params.getlist('category[]') or None
tags = request.GET.get('tags', None)
price_min = request.GET.get('price_min', None)
price_max = request.GET.get('price_max', None)
@@ -185,7 +186,7 @@ def product_search(request):
if tags:
products_qs = Product.objects.filter(tags=tags)
if category:
products_qs = Product.objects.filter(category=category)
products_qs = Product.objects.filter(category__name__in=category)
# serialize and list data
serializer = ProductSerializer(products_qs, many=True)
result_list = [dict(i) for i in serializer.data]
@@ -290,7 +291,7 @@ def purchase_email(request):
return Response({"error": "Invalid value for product"}, status=status.HTTP_406_NOT_ACCEPTABLE)
# check company.email
if company.email is None:
return Response({"error": "Related compay has no contact email address"}, status=status.HTTP_406_NOT_ACCEPTABLE)
company.email = managing_user.email
try:
# send email to company
company_message = render_to_string('purchase_notification_v2.html', {