Browse Source

Drobné změny témat

remotes/origin/vysl deploy-prod-2015-09-10-11-11-xlfd
Matěj Kocián 9 years ago
parent
commit
c19167a197
  1. 11
      seminar/templates/seminar/archiv/temata.html
  2. 2
      seminar/urls.py
  3. 7
      seminar/views.py

11
seminar/templates/seminar/archiv/temata.html

@ -3,14 +3,17 @@
{% block content %}
<h2>{% block nadpis1 %} Archiv témat {% endblock %}</h2>
{% for d in object_list %}
<h3>{{ d.rocnik }}. ročník</h3>
{% for tema in object_list %}
{% with tema.cislo_zadani.rocnik.rocnik as rocnik %}
{% ifchanged rocnik %}
{% if not forloop.first %}</ul>{% endif %}
<h3>{{ rocnik }}. ročník</h3>
<ul>
{% for tema in d.temata %}
{% endifchanged %}
<li>
<a href="{{ tema.verejne_url }}">{{ tema.kod_v_rocniku }}: {{ tema.nazev }}</a>
{% endwith %}
{% endfor %}
</ul>
{% endfor %}
{% endblock content %}

2
seminar/urls.py

@ -18,7 +18,7 @@ urlpatterns = patterns('',
url(r'^soustredeni/(?P<pk>\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'),

7
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

Loading…
Cancel
Save