From 8d22ab3c91b33eedaa930c66d8707714068262b8 Mon Sep 17 00:00:00 2001 From: LEdoian Date: Fri, 21 Sep 2018 00:25:54 +0200 Subject: [PATCH] =?UTF-8?q?Hez=C4=8D=C3=AD=20verze?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- korektury/templates/korektury/seznam.html | 10 +--------- korektury/views.py | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/korektury/templates/korektury/seznam.html b/korektury/templates/korektury/seznam.html index 6420ec7d..2498fbce 100644 --- a/korektury/templates/korektury/seznam.html +++ b/korektury/templates/korektury/seznam.html @@ -2,15 +2,7 @@ {% load staticfiles %} {% block submenu %} - {% if aktualni %} - {% with "aktualni" as selected %} - {% include "korektury/submenu.html" %} - {% endwith %} - {% else %} - {% with "zastarale" as selected %} - {% include "korektury/submenu.html" %} - {% endwith %} - {% endif %} + {% include "korektury/submenu.html" %} {% endblock %} {% block script%} diff --git a/korektury/views.py b/korektury/views.py index bc2acdd8..56f198f2 100644 --- a/korektury/views.py +++ b/korektury/views.py @@ -22,17 +22,26 @@ class KorekturyListView(generic.ListView): template_name = 'korektury/seznam.html' class KorekturyAktualniListView(KorekturyListView): - def __init__ (self): - self.queryset=self.get_queryset().exclude(status="zastarale") + def get_queryset(self, *args, **kwargs): + queryset=super(KorekturyAktualniListView,self).get_queryset() + queryset=queryset.exclude(status="zastarale") + return queryset def get_context_data(self, **kwargs): context = super(KorekturyAktualniListView,self).get_context_data(**kwargs) - context['aktualni'] = True + context['selected'] = 'aktualni' return context class KorekturyZastaraleListView(KorekturyListView): - def __init__ (self): - self.queryset=self.get_queryset().filter(status="zastarale") + def get_queryset(self, *args, **kwargs): + queryset=super(KorekturyZastaraleListView,self).get_queryset() + queryset=queryset.filter(status="zastarale") + return queryset + + def get_context_data(self, **kwargs): + context = super(KorekturyZastaraleListView,self).get_context_data(**kwargs) + context['selected'] = 'zastarale' + return context ### Korektury class KorekturyView(generic.TemplateView):