From 0d5d465d5903d7a157e689e6620634f1d4e1c875 Mon Sep 17 00:00:00 2001 From: Max Yakovenko Date: Sun, 19 Aug 2018 18:12:08 +0300 Subject: [PATCH] add index app --- index/views.py | 10 ++++ templates/index/index.html | 107 +++++++++++++++++++++---------------- 2 files changed, 70 insertions(+), 47 deletions(-) diff --git a/index/views.py b/index/views.py index 798528d..bb1a73a 100644 --- a/index/views.py +++ b/index/views.py @@ -1,13 +1,23 @@ from django.views.generic import TemplateView from django.utils.translation import ugettext_lazy as _ +from cart.models import Client +from core.models import Certificate class IndexView(TemplateView): template_name = 'index/index.html' title = _('Русские программы') + def get_clients(self): + return Client.active.only('name', 'image').all() + + def get_certs(self): + return Certificate.active.only('name', 'image').all() + def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['title'] = self.title + context['clients'] = self.get_clients() + context['certs'] = self.get_certs() return context diff --git a/templates/index/index.html b/templates/index/index.html index 07a1110..d890fb6 100644 --- a/templates/index/index.html +++ b/templates/index/index.html @@ -15,18 +15,17 @@ {% endblock pre_content %} {% block right_common_content %}
- + {% if product_categories %} + + {% endif %}
-
Выбор ПО по разработчику
-
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- + {% if manufacturer_list %} +
Выбор ПО по разработчику
+
+
+ {% for manufacturer in manufacturer_list %} + + {% endfor %}
-
-
Наши клиенты
-
-
    -
  • -
  • -
  • -
-
-
Наши сертефикаты
-
- - -
-
+ {% endif %} + {% if clients %} +
Наши клиенты
+
+ +
+ {% endif %} + {% if certs %} +
Наши сертефикаты
+ +
+ {% endif %} {% endblock right_common_content %}