Merge branch 'Petr'
Conflicts: seminar/templates/seminar/zadani/AktualniZadani.html seminar/views.py
This commit is contained in:
		
						commit
						181e9b74e1
					
				
					 2 changed files with 21 additions and 5 deletions
				
			
		|  | @ -10,14 +10,23 @@ | ||||||
|       {% endif %} |       {% endif %} | ||||||
|       {#TODO a co speciální deadline pro účast na soustředění? #} |       {#TODO a co speciální deadline pro účast na soustředění? #} | ||||||
| 
 | 
 | ||||||
|       {% for problem in zadani %} |     {% for sada in problemy %} | ||||||
|  |       {# podnadpisy, kdyz neni zakomentuje se nadpis #} | ||||||
|  |       {% if not sada %}<!--{% endif %} | ||||||
|  |       <h3>{% cycle 'Úlohy' 'Témata' 'Seriál' %}</h3> | ||||||
|  |       {% if not sada %}-->{% endif %} | ||||||
|  |       {# publikace jednotlivych zadani #} | ||||||
|  |       {% for problem in sada %} | ||||||
|         {# TODO použít {{problem.kod_v_rocniku}} ? vrací 4.u1 místo 4.1 #} |         {# TODO použít {{problem.kod_v_rocniku}} ? vrací 4.u1 místo 4.1 #} | ||||||
|         <h3>{{problem.cislo_zadani.cislo}}.{{problem.kod}} {{problem.nazev}} ({{problem.body}}b)</h3> |         <h4>{{problem.cislo_zadani.cislo}}.{{problem.kod}} {{problem.nazev}} | ||||||
|  |           {# nezobrazuj body, pokud nejsou zadane (typicky u temat)#} | ||||||
|  |           {% if problem.body %}({{problem.body}}b){% endif %}</h4> | ||||||
|         {% autoescape off %}{{problem.text_zadani}}{% endautoescape %} |         {% autoescape off %}{{problem.text_zadani}}{% endautoescape %} | ||||||
|         <hr> |         <hr> | ||||||
|       {% empty %} |  | ||||||
|         Aktuálně nejsou zadané žádné úlohy k řešení. |  | ||||||
|       {% endfor %} |       {% endfor %} | ||||||
|  |     {% empty %} | ||||||
|  |       Aktuálně nejsou zadané žádné úlohy k řešení. | ||||||
|  |     {% endfor %} | ||||||
| 
 | 
 | ||||||
|   {% endwith %} |   {% endwith %} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,3 +1,5 @@ | ||||||
|  | # coding:utf-8 | ||||||
|  | 
 | ||||||
| from django.shortcuts import get_object_or_404, render | from django.shortcuts import get_object_or_404, render | ||||||
| from django.http import HttpResponseRedirect | from django.http import HttpResponseRedirect | ||||||
| from django.core.urlresolvers import reverse | from django.core.urlresolvers import reverse | ||||||
|  | @ -12,9 +14,14 @@ from . import utils | ||||||
| 
 | 
 | ||||||
| def AktualniZadaniView(request): | def AktualniZadaniView(request): | ||||||
|     nastaveni = get_object_or_404(Nastaveni) |     nastaveni = get_object_or_404(Nastaveni) | ||||||
|  |     problemy = Problem.objects.filter(cislo_zadani=nastaveni.aktualni_cislo).filter(stav = 'zadany') | ||||||
|  |     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', |     return render(request, 'seminar/zadani/AktualniZadani.html', | ||||||
|             {'nastaveni': nastaveni, |             {'nastaveni': nastaveni, | ||||||
|              'zadani': nastaveni.aktualni_cislo.zadane_problemy.exclude(typ=Problem.TYP_TEMA), |              'problemy': problemy, | ||||||
|                 }, |                 }, | ||||||
|             ) |             ) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Matěj Kocián
						Matěj Kocián