diff --git a/seminar/templates/seminar/archiv/temata.html b/seminar/templates/seminar/archiv/temata.html
index 56502a5b..b9d57aaa 100644
--- a/seminar/templates/seminar/archiv/temata.html
+++ b/seminar/templates/seminar/archiv/temata.html
@@ -3,14 +3,17 @@
{% block content %}
{% block nadpis1 %} Archiv témat {% endblock %}
- {% for d in object_list %}
- {{ d.rocnik }}. ročník
-
+ {% for tema in object_list %}
+ {% with tema.cislo_zadani.rocnik.rocnik as rocnik %}
+ {% ifchanged rocnik %}
+ {% if not forloop.first %}{% endif %}
+ {{ rocnik }}. ročník
+
{% endblock content %}
diff --git a/seminar/urls.py b/seminar/urls.py
index 1e87e05f..cfb8a658 100644
--- a/seminar/urls.py
+++ b/seminar/urls.py
@@ -18,7 +18,7 @@ urlpatterns = patterns('',
url(r'^soustredeni/(?P\d+)/$', views.SoustredeniView.as_view(), name='seminar_soustredeni'),
url(r'^zadani/aktualni/$', views.AktualniZadaniView, name='seminar_aktualni_zadani'),
- url(r'^zadani/temata/$', views.TemataView, name='seminar_temata'),
+ url(r'^zadani/temata/$', views.ZadaniTemataView, name='seminar_temata'),
url(r'^$', views.TitulniStranaView.as_view(), name='titulni_strana'),
url(r'^stav$', views.StavDatabazeView, name='stav_databaze'),
diff --git a/seminar/views.py b/seminar/views.py
index 13edd7d1..1e5e18fa 100644
--- a/seminar/views.py
+++ b/seminar/views.py
@@ -29,11 +29,11 @@ def AktualniZadaniView(request):
},
)
-def TemataView(request):
+def ZadaniTemataView(request):
nastaveni = get_object_or_404(Nastaveni)
return render(request, 'seminar/zadani/Temata.html',
{
- 'temata': Problem.objects.filter(typ=Problem.TYP_TEMA, cislo_zadani__rocnik=nastaveni.aktualni_rocnik),
+ 'temata': Problem.objects.filter(typ=Problem.TYP_TEMA, stav=Problem.STAV_ZADANY, cislo_zadani__rocnik=nastaveni.aktualni_rocnik),
}
)
@@ -236,8 +236,7 @@ class CisloView(generic.DetailView):
class ArchivTemataView(generic.ListView):
model = Problem
template_name = 'seminar/archiv/temata.html'
- query = Problem.objects.filter(typ=Problem.TYP_TEMA).select_related('cislo_zadani__rocnik__rocnik').order_by('-cislo_zadani__rocnik__rocnik', 'kod')
- queryset = [{"rocnik": r, "temata": list(x)} for r, x in groupby(query, lambda x: x.cislo_zadani.rocnik.rocnik)]
+ queryset = Problem.objects.filter(typ=Problem.TYP_TEMA, stav=Problem.STAV_ZADANY).select_related('cislo_zadani__rocnik__rocnik').order_by('-cislo_zadani__rocnik__rocnik', 'kod')
### Generovani vysledkovky