Drobná oprava titulní strany
This commit is contained in:
		
							parent
							
								
									3233d443c4
								
							
						
					
					
						commit
						5543e368d2
					
				
					 3 changed files with 6 additions and 17 deletions
				
			
		|  | @ -1,13 +1,9 @@ | |||
| {% extends 'titulnistrana.html'} | ||||
| 
 | ||||
| {% block body %} | ||||
| 	{% for novinka in novinky %} | ||||
| 		{% if novinka.datum > pred_2_mesici and novinka.zverejneno %} | ||||
| 	{% for novinka in object_list %} | ||||
| 			<p> | ||||
| 			Tady bude novinka. | ||||
| 			{{ novinka.text }} | ||||
| 			</p> | ||||
| 			<img src='{{ novinka.obrazek }}' | ||||
| 		{% endif %} | ||||
| 			<img src='{{ novinka.obrazek.url }}' | ||||
| 	{% endfor%} | ||||
| {% endblock %} | ||||
|  |  | |||
|  | @ -1,8 +1,7 @@ | |||
| Trala! | ||||
| {% extends 'base.html' %} | ||||
| 
 | ||||
| HU! | ||||
| {% block novinky %} | ||||
| {% block content %} | ||||
| 	Tady bude nadpis pro novinky. | ||||
| 	{% include 'novinky.html' %} | ||||
| 	{% include 'seminar/novinky.html' %} | ||||
| {% endblock %} | ||||
|  |  | |||
|  | @ -41,17 +41,11 @@ def TemataView(request): | |||
| class TitulniStranaView(generic.ListView): | ||||
|     model = Novinky | ||||
|     template_name='seminar/titulnistrana.html' | ||||
|     pred_dvema_mesici = (datetime.date.today() - datetime.timedelta(2*365/12)) | ||||
|     queryset = Novinky.objects.filter(datum__range=(pred_dvema_mesici, datetime.date.today())) | ||||
| 
 | ||||
|     def get_context_data(self, **kwargs): | ||||
|         context = super(TitulniStranaView, self).get_context_data(**kwargs) | ||||
|         context['pred_2_mesici'] = (datetime.date.today() - datetime.timedelta(2*365/12)).isoformat() | ||||
|         #ulozi datum pred dvema mesici | ||||
|         #elegantneji mozne pomoci dateutil: | ||||
|         ''' | ||||
|         from dateutil.relativedelta import relativedelta | ||||
| 
 | ||||
|         date.today() + relativedelta(month=-2) | ||||
|         ''' | ||||
|         return context | ||||
| 
 | ||||
| ### Co je M&M | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Matěj Kocián
						Matěj Kocián