Merge branch 'test'
This commit is contained in:
		
						commit
						b8574cf2c7
					
				
					 2 changed files with 18 additions and 15 deletions
				
			
		|  | @ -1,19 +1,7 @@ | |||
| {% block content %} | ||||
| {% spaceless %} | ||||
| {% for hlas in hlasovani %} | ||||
| hlas({{hlas.ucastnik}},{{hlas.prednaska.id}},{{hlas.body}}) | ||||
| {% endfor %} | ||||
| {% for prednaska in prednasky %} | ||||
| prednaska({{prednaska.id}},{{prednaska.org.id}},{{prednaska.obtiznost}},{{prednaska.obor}}) | ||||
| {% endfor %} | ||||
| {% for org in orgove %} | ||||
| org({{org.id}},4,0,15) | ||||
| {% endfor %} | ||||
| {% for org in orgove %} | ||||
| {{org.id}};{{org}} | ||||
| {% endfor %} | ||||
| {% for prednaska in prednasky %} | ||||
| {{prednaska.id}};{{prednaska.nazev}};{{prednaska.org.id}} | ||||
| {{prednaska.id}};{{prednaska.nazev}};{{prednaska.org}} | ||||
| {{prednaska.body}} | ||||
| {% endfor %} | ||||
| {% endspaceless %} | ||||
|  |  | |||
|  | @ -57,9 +57,24 @@ class SeznamListView(generic.ListView): | |||
|         self.seznam = get_object_or_404(Seznam, id=self.kwargs["seznam"]) | ||||
|         prednasky = Prednaska.objects.filter(seznamy=self.seznam).order_by( | ||||
|             'org__user__first_name', 'org__user__last_name' | ||||
|         ).annotate(body=Sum('hlasovani__body')) | ||||
|         ) | ||||
|         return prednasky | ||||
| 
 | ||||
|     # FIXME nahradit anotaci s filtrem po prechodu na Django 2.2 | ||||
|     def get_context_data(self,**kwargs): | ||||
|         context = super(SeznamListView, self).get_context_data(**kwargs) | ||||
| 
 | ||||
|         # hlasovani se vztahuje k nejnovejsimu soustredeni | ||||
|         sous = Soustredeni.objects.first() | ||||
|         seznam = Seznam.objects.filter(soustredeni = sous, stav = STAV_NAVRH).first() | ||||
| 	 | ||||
| 	for obj in self.object_list: | ||||
| 		hlasovani_set = obj.hlasovani_set.filter(seznam=seznam).only('body') | ||||
| 		obj.body = sum(map(lambda x: x.body,hlasovani_set)) | ||||
| 
 | ||||
| 	return context | ||||
|     	 | ||||
| 
 | ||||
| 
 | ||||
| def SeznamExportView(request, seznam): | ||||
|     u"""Vypíše výsledky hlasování ve formátu pro prologovský optimalizátor""" | ||||
|  | @ -86,7 +101,7 @@ def SeznamExportView(request, seznam): | |||
|         request, | ||||
|         'prednasky/seznam_prednasek_export.txt', | ||||
|         {"hlasovani": hlasovani, "prednasky": prednasky, "orgove": orgove}, | ||||
|         content_type="text/plain" | ||||
|         content_type="text/plain; charset=utf-8" | ||||
|     ) | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue