Pokus o opravu ClankyResitelView
This commit is contained in:
		
							parent
							
								
									6491d63714
								
							
						
					
					
						commit
						714fb43eab
					
				
					 1 changed files with 11 additions and 9 deletions
				
			
		|  | @ -1012,19 +1012,21 @@ def group_by_rocnik(clanky): | ||||||
| 	 | 	 | ||||||
| 
 | 
 | ||||||
| # FIXME: clanky jsou vsechny, pokud budou i neresitelske, tak se take zobrazi | # FIXME: clanky jsou vsechny, pokud budou i neresitelske, tak se take zobrazi | ||||||
|  | # FIXME: Původně tu byl kód přímo v těle třídy, což rozbíjelo migrace. Opravil jsem, ale vůbec nevím, jestli to funguje. | ||||||
| class ClankyResitelView(generic.ListView): | class ClankyResitelView(generic.ListView): | ||||||
| 	model = Problem | 	model = Problem | ||||||
| 	template_name = 'seminar/clanky/resitelske_clanky.html' | 	template_name = 'seminar/clanky/resitelske_clanky.html' | ||||||
| 	#queryset |  | ||||||
| 	clanky = Clanek.objects.filter(stav=Problem.STAV_ZADANY).select_related('cislo__rocnik').order_by('-cislo__rocnik__rocnik') |  | ||||||
| 	queryset = [] |  | ||||||
| 	skupiny_clanku = group_by_rocnik(clanky) |  | ||||||
| 	for skupina in skupiny_clanku: |  | ||||||
| 		skupina.sort(key=lambda clanek: clanek.kod_v_rocniku()) |  | ||||||
| 		for clanek in skupina: |  | ||||||
| 			queryset.append(clanek) |  | ||||||
| 
 | 
 | ||||||
| 	#zadani__rocnik').order_by('-cislo_zadani__rocnik__rocnik', 'kod') | 	# FIXME: QuerySet není pole! | ||||||
|  | 	def get_queryset(self): | ||||||
|  | 		clanky = Clanek.objects.filter(stav=Problem.STAV_ZADANY).select_related('cislo__rocnik').order_by('-cislo__rocnik__rocnik') | ||||||
|  | 		queryset = [] | ||||||
|  | 		skupiny_clanku = group_by_rocnik(clanky) | ||||||
|  | 		for skupina in skupiny_clanku: | ||||||
|  | 			skupina.sort(key=lambda clanek: clanek.kod_v_rocniku()) | ||||||
|  | 			for clanek in skupina: | ||||||
|  | 				queryset.append(clanek) | ||||||
|  | 		return queryset | ||||||
| 
 | 
 | ||||||
| # FIXME: pokud chceme orgoclanky, tak nejak zavest do modelu a podle toho odkomentovat a upravit | # FIXME: pokud chceme orgoclanky, tak nejak zavest do modelu a podle toho odkomentovat a upravit | ||||||
| #class ClankyOrganizatorView(generic.ListView)<F12>: | #class ClankyOrganizatorView(generic.ListView)<F12>: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Pavel "LEdoian" Turinsky
						Pavel "LEdoian" Turinsky