Ad hoc ubastlená zarážka pro odstínění moc starých řešitelů
Není to hezké ani elegantní ani správné, ale asi je to funkční :-)
This commit is contained in:
		
							parent
							
								
									6ddcae2d69
								
							
						
					
					
						commit
						9d5dc3c213
					
				
					 2 changed files with 32 additions and 0 deletions
				
			
		
							
								
								
									
										19
									
								
								mamweb/templates/universal.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								mamweb/templates/universal.html
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,19 @@ | ||||||
|  | {% extends 'base.html' %} | ||||||
|  | 
 | ||||||
|  | {# Tohle je univerzální template pro potřebu zobrazovat triviální hlášky generované v kódu. __Není__ určen pro sofistikované použití ani pro zneužívání! #} | ||||||
|  | 
 | ||||||
|  | {% block nadpis1a %}{% block nadpis1b %} | ||||||
|  | {{ title }} | ||||||
|  | {% endblock %}{% endblock %} | ||||||
|  | 
 | ||||||
|  | {% block content %} | ||||||
|  | {% if error %} | ||||||
|  | <p style="color: red;">{{ error }}</p> | ||||||
|  | {% endif %} | ||||||
|  | {% if text %} | ||||||
|  | <p>{{ text }}</p> | ||||||
|  | {% endif %} | ||||||
|  | {% if raw_html %} | ||||||
|  | {{ raw_html | safe }} | ||||||
|  | {% endif %} | ||||||
|  | {% endblock %} | ||||||
|  | @ -1056,6 +1056,19 @@ class NahrajReseniView(LoginRequiredMixin, CreateView): | ||||||
| 	form_class = f.NahrajReseniForm | 	form_class = f.NahrajReseniForm | ||||||
| 	success_url = '/' | 	success_url = '/' | ||||||
| 
 | 
 | ||||||
|  | 	def get(self, request, *args, **kwargs): | ||||||
|  | 		# Zaříznutí starých řešitelů: | ||||||
|  | 		# FIXME: Je to tady dost naprasené, mělo by to asi být jinde… | ||||||
|  | 		osoba = m.Osoba.objects.get(user=self.request.user) | ||||||
|  | 		resitel = osoba.resitel | ||||||
|  | 		if resitel.rok_maturity <= m.Nastaveni.get_solo().aktualni_rocnik.prvni_rok: | ||||||
|  | 			return render(request, 'universal.html', { | ||||||
|  | 				'title': 'Nelze odevzdat', | ||||||
|  | 				'error': 'Zdá se, že jsi již odmaturoval/a, a tedy nemůžeš odevzdat do našeho semináře řešení.', | ||||||
|  | 				'text': 'Pokud se ti zdá, že to je chyba, napiš nám prosím e-mail. Díky.', | ||||||
|  | 				}) | ||||||
|  | 		super().get(request, *args, **kwargs) | ||||||
|  | 
 | ||||||
| 	def get_context_data(self,**kwargs): | 	def get_context_data(self,**kwargs): | ||||||
| 		data = super().get_context_data(**kwargs) | 		data = super().get_context_data(**kwargs) | ||||||
| 		if self.request.POST: | 		if self.request.POST: | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 MaM Web user
						MaM Web user