Aktualni zadani rozdeleno na ulohy, temata a serial
This commit is contained in:
		
							parent
							
								
									de262ffcdc
								
							
						
					
					
						commit
						6c6417b23f
					
				
					 2 changed files with 19 additions and 4 deletions
				
			
		|  | @ -10,14 +10,21 @@ | ||||||
|       {% 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 ac.zadane_problemy.all %} | 
 | ||||||
|  |     <br><br> | ||||||
|  |     {% for sada in problemy%} | ||||||
|  |       {% if sada %}<h3>{% cycle 'Úlohy:' 'Témata:' 'Seriál:' %}</h3>{% endif %} | ||||||
|  |       {% 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,8 +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) | ||||||
|  |     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, | ||||||
|  |              'problemy'  : problemy, | ||||||
|                 }, |                 }, | ||||||
|             ) |             ) | ||||||
| ### Titulni strana | ### Titulni strana | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Bc. Petr Pecha
						Bc. Petr Pecha