Fix: #1251 #6
					 5 changed files with 1 additions and 110 deletions
				
			
		|  | @ -40,8 +40,7 @@ | ||||||
|           <li><a href="obalky.pdf">Obálky (PDF)</a></li> |           <li><a href="obalky.pdf">Obálky (PDF)</a></li> | ||||||
|           <li><a href="tituly.tex" download>Tituly (TeX)</a></li> |           <li><a href="tituly.tex" download>Tituly (TeX)</a></li> | ||||||
|           <li><a href="vysledkovka.tex" download>Výsledkovka (TeX)</a></li> |           <li><a href="vysledkovka.tex" download>Výsledkovka (TeX)</a></li> | ||||||
|           <li><a href="obalkovani">Obálkování</a></li> |           <li><a href="odmeny/{{prevcislo.rocnik.rocnik}}.{{prevcislo.poradi}}/">Odměny</a></li> | ||||||
| 	  <li><a href="odmeny/{{prevcislo.rocnik.rocnik}}.{{prevcislo.poradi}}/">Odměny</a></li> |  | ||||||
|         </ul> |         </ul> | ||||||
|       </div> |       </div> | ||||||
|   {% endif %} |   {% endif %} | ||||||
|  |  | ||||||
|  | @ -1,33 +0,0 @@ | ||||||
| {% extends "base.html" %} |  | ||||||
| 
 |  | ||||||
| {% block content %} |  | ||||||
|   <h1> |  | ||||||
|     {% block nadpis1a %} |  | ||||||
|       Obálkování {{ cislo }} |  | ||||||
|     {% endblock %} |  | ||||||
|   </h1> |  | ||||||
| 
 |  | ||||||
|   Obálkovat se budou tyto problémy: |  | ||||||
|   <ul> |  | ||||||
|     {% for p in problemy %} |  | ||||||
| 
 |  | ||||||
|       <li> {{ p.kod_v_rocniku }} {{ p }} |  | ||||||
|     {% endfor %} |  | ||||||
|   </ul> |  | ||||||
| 
 |  | ||||||
|   {% for r in reseni %} |  | ||||||
|     {% ifchanged r.resitel %} |  | ||||||
|       {% if not forloop.first %} |  | ||||||
|         </ul> |  | ||||||
|       {% endif %} |  | ||||||
|       <h4>{{ r.resitel }}</h4> |  | ||||||
|         <ul> |  | ||||||
|     {% endifchanged %} |  | ||||||
| 
 |  | ||||||
|     <li> |  | ||||||
|       {{ r.problem.kod_v_rocniku }} {{ r.problem.nazev }} ({{ r.body }}) |  | ||||||
| 
 |  | ||||||
|   {% endfor %} |  | ||||||
|   </ul> |  | ||||||
| 
 |  | ||||||
| {% endblock content %} |  | ||||||
|  | @ -1,30 +0,0 @@ | ||||||
| {% extends "base.html" %} |  | ||||||
| 
 |  | ||||||
| {% block content %} |  | ||||||
|   <h1> |  | ||||||
|     {% block nadpis1a %} |  | ||||||
|       Obálkování {{ cislo }} |  | ||||||
|     {% endblock %} |  | ||||||
|   </h1> |  | ||||||
|   <ul> |  | ||||||
|   {% for reseni in object_list %} |  | ||||||
| 	{% ifchanged reseni.resitele %} |  | ||||||
| 		{% if not forloop.first %} |  | ||||||
| 		 </ul> |  | ||||||
| 		{% endif %} |  | ||||||
| 		<h4>{% for resitel in reseni.resitele.all %}{{resitel.osoba}},{% endfor %}</h4> |  | ||||||
| 	<ul> |  | ||||||
| 	{% endifchanged %} |  | ||||||
| 
 |  | ||||||
|   <li>Celkem {{reseni.hodnoceni__body__sum}} bodů z {{reseni.hodnoceni__count}} hodnocení |  | ||||||
| 	<ul> |  | ||||||
| 		{% for h in reseni.hodnoceni_set.all %} |  | ||||||
| 		<li> {{ h.problem }}: {{ h.body }}b </li> |  | ||||||
| 		{% endfor %} |  | ||||||
| 	</ul> |  | ||||||
|   </li> |  | ||||||
|   {% endfor %} |  | ||||||
|   </ul> |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| {% endblock content %} |  | ||||||
|  | @ -23,7 +23,6 @@ Soubor sloužící jako „router“, tj. zde se definují url adresy a na co uk | ||||||
| 	- ``cislo/<int:rocnik>.<str:cislo>/obalky.pdf`` (seminar_cislo_obalky) :func:`~seminar.views.views_all.cisloObalkyView` | 	- ``cislo/<int:rocnik>.<str:cislo>/obalky.pdf`` (seminar_cislo_obalky) :func:`~seminar.views.views_all.cisloObalkyView` | ||||||
| 	- ``cislo/<int:rocnik>.<str:cislo>/tituly.tex`` (seminar_cislo_titul) :func:`~seminar.views.views_all.TitulyView` | 	- ``cislo/<int:rocnik>.<str:cislo>/tituly.tex`` (seminar_cislo_titul) :func:`~seminar.views.views_all.TitulyView` | ||||||
| 	- ``stav`` (stav_databaze) :func:`~seminar.views.views_all.StavDatabazeView` | 	- ``stav`` (stav_databaze) :func:`~seminar.views.views_all.StavDatabazeView` | ||||||
| 	- ``cislo/<int:rocnik>.<str:cislo>/obalkovani`` (seminar_cislo_resitel_obalkovani) :class:`~seminar.views.views_all.ObalkovaniView` |  | ||||||
| 	- ``cislo/<int:trocnik>.<str:tcislo>/odmeny/<int:frocnik>.<str:fcislo>/`` (seminar_archiv_odmeny) :class:`~seminar.views.views_all.OdmenyView` | 	- ``cislo/<int:trocnik>.<str:tcislo>/odmeny/<int:frocnik>.<str:fcislo>/`` (seminar_archiv_odmeny) :class:`~seminar.views.views_all.OdmenyView` | ||||||
| - Další | - Další | ||||||
| 	- `` `` (titulni_strana) :class:`~seminar.views.views_all.TitulniStranaView` | 	- `` `` (titulni_strana) :class:`~seminar.views.views_all.TitulniStranaView` | ||||||
|  | @ -102,11 +101,6 @@ urlpatterns = [ | ||||||
| 		org_required(views.StavDatabazeView), | 		org_required(views.StavDatabazeView), | ||||||
| 		name='stav_databaze' | 		name='stav_databaze' | ||||||
| 	), | 	), | ||||||
| 	path( |  | ||||||
| 		'cislo/<int:rocnik>.<str:cislo>/obalkovani', |  | ||||||
| 		org_required(views.ObalkovaniView.as_view()), |  | ||||||
| 		name='seminar_cislo_resitel_obalkovani' |  | ||||||
| 	), |  | ||||||
| 	path( | 	path( | ||||||
| 		'cislo/<int:trocnik>.<str:tcislo>/odmeny/<int:frocnik>.<str:fcislo>/', | 		'cislo/<int:trocnik>.<str:tcislo>/odmeny/<int:frocnik>.<str:fcislo>/', | ||||||
| 		org_required(views.OdmenyView.as_view()), | 		org_required(views.OdmenyView.as_view()), | ||||||
|  |  | ||||||
|  | @ -53,23 +53,6 @@ logger = logging.getLogger(__name__) | ||||||
| def get_problemy_k_tematu(tema): | def get_problemy_k_tematu(tema): | ||||||
| 	return Problem.objects.filter(nadproblem = tema) | 	return Problem.objects.filter(nadproblem = tema) | ||||||
| 
 | 
 | ||||||
| class ObalkovaniView(generic.ListView): |  | ||||||
| 	template_name = 'seminar/org/obalkovani.html' |  | ||||||
| 
 |  | ||||||
| 	def get_queryset(self): |  | ||||||
| 		rocnik = get_object_or_404(Rocnik,rocnik=self.kwargs['rocnik']) |  | ||||||
| 		cislo = get_object_or_404(Cislo,rocnik=rocnik,poradi=self.kwargs['cislo']) |  | ||||||
| 		self.cislo = cislo |  | ||||||
| 		self.hodnoceni = s.Hodnoceni.objects.filter(cislo_body=cislo) |  | ||||||
| 		self.reseni = Reseni.objects.filter(hodnoceni__in = self.hodnoceni).annotate(Sum('hodnoceni__body')).annotate(Count('hodnoceni')).order_by('resitele__osoba') |  | ||||||
| 		return self.reseni |  | ||||||
| 
 |  | ||||||
| 	def get_context_data(self, **kwargs): |  | ||||||
| 		context = super(ObalkovaniView, self).get_context_data(**kwargs) |  | ||||||
| 		print(self.cislo) |  | ||||||
| 		context['cislo'] = self.cislo |  | ||||||
| 		return context |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| # FIXME: Pozor, níž je ještě jeden ProblemView! | # FIXME: Pozor, níž je ještě jeden ProblemView! | ||||||
| #class ProblemView(generic.DetailView): | #class ProblemView(generic.DetailView): | ||||||
|  | @ -597,28 +580,6 @@ def obalkyView(request, resitele): | ||||||
| 	return response | 	return response | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def oldObalkovaniView(request, rocnik, cislo): |  | ||||||
| 	rocnik = Rocnik.objects.get(rocnik=rocnik) |  | ||||||
| 	cislo = Cislo.objects.get(rocnik=rocnik, cislo=cislo) |  | ||||||
| 
 |  | ||||||
| 	reseni = ( |  | ||||||
| 		Reseni.objects.filter(cislo_body=cislo) |  | ||||||
| 		.order_by( |  | ||||||
| 			'resitel__prijmeni', |  | ||||||
| 			'resitel__jmeno', |  | ||||||
| 			'problem__typ', |  | ||||||
| 			'problem__kod' |  | ||||||
| 		) |  | ||||||
| 	) |  | ||||||
| 
 |  | ||||||
| 	problemy = sorted(set(r.problem for r in reseni), key=lambda p: (p.typ, p.kod)) |  | ||||||
| 	return render( |  | ||||||
| 		request, |  | ||||||
| 		'seminar/archiv/cislo_obalkovani.html', |  | ||||||
| 		{'cislo': cislo, 'problemy': problemy, 'reseni': reseni} |  | ||||||
| 	) |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| ### Tituly | ### Tituly | ||||||
| def TitulyViewRocnik(request, rocnik): | def TitulyViewRocnik(request, rocnik): | ||||||
| 	return TitulyView(request, rocnik, None) | 	return TitulyView(request, rocnik, None) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue