Částečná oprava autocomplete
Už to má v seznamu správné problémy, ale neumí to hledat.
This commit is contained in:
		
							parent
							
								
									4321eda97d
								
							
						
					
					
						commit
						5c9632d8fe
					
				
					 1 changed files with 11 additions and 9 deletions
				
			
		|  | @ -33,15 +33,17 @@ class OdevzdatelnyProblemAutocomplete(autocomplete.Select2QuerySetView): | |||
| 	def get_queryset(self): | ||||
| 		nastaveni = get_object_or_404(m.Nastaveni) | ||||
| 		rocnik = nastaveni.aktualni_rocnik | ||||
| 		temata = m.Tema.objects.filter(rocnik=rocnik, stav=m.Problem.STAV_ZADANY) | ||||
| 		ulohy = m.Uloha.objects.filter(cislo_deadline__rocnik = rocnik) | ||||
| 		clanky = m.Clanek.objects.filter(cislo__rocnik = rocnik, stav=m.Problem.STAV_ZADANY) # FIXME: Je tohle to, co chceme? | ||||
| 		print(temata, ulohy, clanky) | ||||
| 		ulohy.union(temata, all=True) | ||||
| 		print(ulohy) | ||||
| 		ulohy.union(clanky, all=True) | ||||
| 		print(ulohy) | ||||
| 		qs = ulohy | ||||
| 		# Od tohoto místa dál jsem zkoušel spoustu variací podle https://django-polymorphic.readthedocs.io/en/stable/advanced.html | ||||
| 		temaQ = Q(Tema___rocnik = rocnik, stav=m.Problem.STAV_ZADANY) | ||||
| 		ulohaQ = Q(Uloha___cislo_deadline__rocnik = rocnik, stav=m.Problem.STAV_ZADANY) | ||||
| 		clanekQ = Q(Clanek___cislo__rocnik = rocnik, stav=m.Problem.STAV_ZADANY) | ||||
| 		qs = m.Problem.objects.filter(temaQ | ulohaQ | clanekQ) | ||||
| 		#print(temata, ulohy, clanky) | ||||
| 		#ulohy.union(temata, all=True) | ||||
| 		#print(ulohy) | ||||
| 		#ulohy.union(clanky, all=True) | ||||
| 		#print(ulohy) | ||||
| 		#qs = ulohy | ||||
| 		print(qs) | ||||
| 		if self.q: | ||||
| 			qs = qs.filter( | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 MaM Web user
						MaM Web user