-->
- Доставка по Казахстану: от 2 до 12 дней, в зависимости от выбранного способа доставки.
+
+ Доставка по Казахстану: от 2 до 12 дней, в зависимости от выбранного способа
+ доставки.
+
@@ -94,10 +97,19 @@
Цены и наличие товара актуальны
@@ -117,67 +129,74 @@
{{ product.description|linebreaks|safe }}
{% if product.video %}
-
- Видео обзор
-
-
-
- {%endif%}
+
+ Видео обзор
+
+
+
+ {% endif %}
{% if ranee %}
-
- Ранее просмотренные товары
+
+ Ранее просмотренные товары
-
-
- {% for product in ranee %}
-
-
- {% set im = product.main_image()|thumbnail("420x420") %}
-

-
-
-
- {{ product.min_price(request.user) }} ₸
-
- {% if product.in_stock() %}
-
-
Товар
- есть в наличии
+
+
+ {% for product in ranee %}
+
+
+ {% set im = product.main_image()|thumbnail("420x420") %}
+

+
+
- {% else %}
-
-
Товара
- нет в наличии
+
+ {{ product.min_price(request.user) }} ₸
- {% endif %}
-
{% if product.in_stock() %}
-
Добавить в корзину
+
+ Товар
+ есть в наличии
+
{% else %}
-
Заказать
+
+ Товара
+ нет в наличии
+
{% endif %}
+
-
- {% endfor %}
+ {% endfor %}
+
-
diff --git a/main/views.py b/main/views.py
index cbe10d5..01fa040 100644
--- a/main/views.py
+++ b/main/views.py
@@ -109,7 +109,7 @@ def temp_count_update(request, article):
product.delivery_date = delivery_date
product.save()
if delivery_date is None:
- product.delivery_date = ''
+ product.delivery_date = None
product.save()
else:
retval['error_code'] = 1
diff --git a/store/models.py b/store/models.py
index c47b4d4..5f1f6aa 100644
--- a/store/models.py
+++ b/store/models.py
@@ -203,6 +203,12 @@ class Product(models.Model):
def in_stock(self):
return self.variations.filter(in_stock__gt=0).count()
+ def delivery_date(self):
+ try:
+ return self.variations.filter(delivery_date__isnull=False)[0].delivery_date
+ except:
+ return None
+
def min_price_variation(self):
min_v = None
for v in self.variations.all():