Hezčí verze

This commit is contained in:
LEdoian 2018-09-21 00:25:54 +02:00
parent 2e9ff73eac
commit 8d22ab3c91
2 changed files with 15 additions and 14 deletions

View file

@ -2,15 +2,7 @@
{% load staticfiles %} {% load staticfiles %}
{% block submenu %} {% block submenu %}
{% if aktualni %} {% include "korektury/submenu.html" %}
{% with "aktualni" as selected %}
{% include "korektury/submenu.html" %}
{% endwith %}
{% else %}
{% with "zastarale" as selected %}
{% include "korektury/submenu.html" %}
{% endwith %}
{% endif %}
{% endblock %} {% endblock %}
{% block script%} {% block script%}

View file

@ -22,17 +22,26 @@ class KorekturyListView(generic.ListView):
template_name = 'korektury/seznam.html' template_name = 'korektury/seznam.html'
class KorekturyAktualniListView(KorekturyListView): class KorekturyAktualniListView(KorekturyListView):
def __init__ (self): def get_queryset(self, *args, **kwargs):
self.queryset=self.get_queryset().exclude(status="zastarale") queryset=super(KorekturyAktualniListView,self).get_queryset()
queryset=queryset.exclude(status="zastarale")
return queryset
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(KorekturyAktualniListView,self).get_context_data(**kwargs) context = super(KorekturyAktualniListView,self).get_context_data(**kwargs)
context['aktualni'] = True context['selected'] = 'aktualni'
return context return context
class KorekturyZastaraleListView(KorekturyListView): class KorekturyZastaraleListView(KorekturyListView):
def __init__ (self): def get_queryset(self, *args, **kwargs):
self.queryset=self.get_queryset().filter(status="zastarale") 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 ### Korektury
class KorekturyView(generic.TemplateView): class KorekturyView(generic.TemplateView):