From 6c6417b23fe154bce77dcce0e5c5f2a690bbdf67 Mon Sep 17 00:00:00 2001 From: "Bc. Petr Pecha" Date: Mon, 7 Sep 2015 09:37:29 +0200 Subject: [PATCH] Aktualni zadani rozdeleno na ulohy, temata a serial --- .../templates/seminar/zadani/AktualniZadani.html | 15 +++++++++++---- seminar/views.py | 8 ++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/seminar/templates/seminar/zadani/AktualniZadani.html b/seminar/templates/seminar/zadani/AktualniZadani.html index 70964b67..4e82f93f 100644 --- a/seminar/templates/seminar/zadani/AktualniZadani.html +++ b/seminar/templates/seminar/zadani/AktualniZadani.html @@ -10,14 +10,21 @@ {% endif %} {#TODO a co speciální deadline pro účast na soustředění? #} - {% for problem in ac.zadane_problemy.all %} + +

+ {% for sada in problemy%} + {% if sada %}

{% cycle 'Úlohy:' 'Témata:' 'Seriál:' %}

{% endif %} + {% for problem in sada %} {# TODO použít {{problem.kod_v_rocniku}} ? vrací 4.u1 místo 4.1 #} -

{{problem.cislo_zadani.cislo}}.{{problem.kod}} {{problem.nazev}} ({{problem.body}}b)

+

{{problem.cislo_zadani.cislo}}.{{problem.kod}} {{problem.nazev}} + {# nezobrazuj body, pokud nejsou zadane (typicky u temat)#} + {% if problem.body %}({{problem.body}}b){% endif %}

{% autoescape off %}{{problem.text_zadani}}{% endautoescape %}
- {% empty %} - Aktuálně nejsou zadané žádné úlohy k řešení. {% endfor %} + {% empty %} + Aktuálně nejsou zadané žádné úlohy k řešení. + {% endfor %} {% endwith %} diff --git a/seminar/views.py b/seminar/views.py index c654f60f..b57e9e8a 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -1,3 +1,5 @@ +# coding:utf-8 + from django.shortcuts import get_object_or_404, render from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse @@ -12,8 +14,14 @@ from . import utils def AktualniZadaniView(request): nastaveni = get_object_or_404(Nastaveni) + problemy = Problem.objects.filter(cislo_zadani=nastaveni.aktualni_cislo) + ulohy = problemy.filter(typ = 'uloha') + temata = problemy.filter(typ = 'tema') + serialy = problemy.filter(typ = 'serial') + problemy = [ulohy, temata, serialy] return render(request, 'seminar/zadani/AktualniZadani.html', {'nastaveni' : nastaveni, + 'problemy' : problemy, }, ) ### Titulni strana