Browse Source

Hezčí verze

middleware_test
LEdoian 6 years ago
parent
commit
8d22ab3c91
  1. 8
      korektury/templates/korektury/seznam.html
  2. 19
      korektury/views.py

8
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 %}
{% endblock %}
{% block script%}

19
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):

Loading…
Cancel
Save