Revert "Odevzdávátko: ve třídě nemá být kód, jinak to rozbíjí testdata"
Pořád je to rozbitý, budu si s tím hrát separátně
This reverts commit dcfda3ff4e.
			
			
This commit is contained in:
		
							parent
							
								
									dcfda3ff4e
								
							
						
					
					
						commit
						1c8cf08f32
					
				
					 1 changed files with 2 additions and 6 deletions
				
			
		|  | @ -382,15 +382,11 @@ class OdevzdavatkoTabulkaFiltrForm(forms.Form): | ||||||
| 
 | 
 | ||||||
| 		return result | 		return result | ||||||
| 
 | 
 | ||||||
| 	def __init__(self, *args, **kwargs): |  | ||||||
| 		super().__init__(*args, **kwargs) |  | ||||||
| 		# choices jako parametr Select widgetu neumí brát callable, jen iterable, takže si pro jednoduchost můžu rovnou uložit výsledek sem... |  | ||||||
| 		# A "sem" znamená do libovolné metody, protože jinak se jedná o kód, který django spustí při inicializaci a protože potřebujeme databázi, tak by spadnul při vyrábění testdat... |  | ||||||
| 		self.terminy = self.gen_terminy() |  | ||||||
| 
 |  | ||||||
| 	# NOTE: Initial definuji pro jednotlivé fieldy, aby to bylo tady a nebylo potřeba to řešit ve views... | 	# NOTE: Initial definuji pro jednotlivé fieldy, aby to bylo tady a nebylo potřeba to řešit ve views... | ||||||
| 	resitele = forms.ChoiceField(choices=RESITELE_CHOICES, initial=RESITELE_RELEVANTNI) | 	resitele = forms.ChoiceField(choices=RESITELE_CHOICES, initial=RESITELE_RELEVANTNI) | ||||||
| 	problemy = forms.ChoiceField(choices=PROBLEMY_CHOICES, initial=PROBLEMY_MOJE) | 	problemy = forms.ChoiceField(choices=PROBLEMY_CHOICES, initial=PROBLEMY_MOJE) | ||||||
| 	 | 	 | ||||||
|  | 	# choices jako parametr Select widgetu neumí brát callable, jen iterable, takže si pro jednoduchost můžu rovnou uložit výsledek sem... | ||||||
|  | 	terminy = gen_terminy() | ||||||
| 	reseni_od = forms.DateField(input_formats=[DATE_FORMAT], widget=forms.Select(choices=terminy), initial=terminy[-2]) | 	reseni_od = forms.DateField(input_formats=[DATE_FORMAT], widget=forms.Select(choices=terminy), initial=terminy[-2]) | ||||||
| 	reseni_do = forms.DateField(input_formats=[DATE_FORMAT], widget=forms.Select(choices=terminy), initial=terminy[-1]) | 	reseni_do = forms.DateField(input_formats=[DATE_FORMAT], widget=forms.Select(choices=terminy), initial=terminy[-1]) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Pavel "LEdoian" Turinsky
						Pavel "LEdoian" Turinsky