From 4c2bf9cbf96efab00fdacc57045579dc6045423a Mon Sep 17 00:00:00 2001 From: Skia Date: Thu, 8 Sep 2016 02:09:17 +0200 Subject: [PATCH] Launderette and product list fixes --- counter/models.py | 4 ++-- counter/templates/counter/product_list.jinja | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/counter/models.py b/counter/models.py index 03fc92c6..1c049f76 100644 --- a/counter/models.py +++ b/counter/models.py @@ -269,7 +269,7 @@ class Selling(models.Model): self.customer.amount -= self.quantity * self.unit_price self.customer.save() self.is_validated = True - if self.product.id == settings.SITH_PRODUCT_SUBSCRIPTION_ONE_SEMESTER: + if self.product and self.product.id == settings.SITH_PRODUCT_SUBSCRIPTION_ONE_SEMESTER: s = Subscriber.objects.filter(id=self.customer.user.id).first() sub = Subscription( member=s, @@ -284,7 +284,7 @@ class Selling(models.Model): duration=settings.SITH_SUBSCRIPTIONS[sub.subscription_type]['duration'], start=sub.subscription_start) sub.save() - elif self.product.id == settings.SITH_PRODUCT_SUBSCRIPTION_TWO_SEMESTERS: + elif self.product and self.product.id == settings.SITH_PRODUCT_SUBSCRIPTION_TWO_SEMESTERS: s = Subscriber.objects.filter(id=self.customer.user.id).first() sub = Subscription( member=s, diff --git a/counter/templates/counter/product_list.jinja b/counter/templates/counter/product_list.jinja index 05630a47..1391e52d 100644 --- a/counter/templates/counter/product_list.jinja +++ b/counter/templates/counter/product_list.jinja @@ -5,7 +5,7 @@ {% endblock %} {% block content %} -{% if tab == "products" %} +{% if current_tab == "products" %}

{% trans %}New product{% endtrans %}

{% endif %} {% if product_list %}