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 %}
|
{% block body %}
|
||||||
{% for novinka in novinky %}
|
{% for novinka in object_list %}
|
||||||
{% if novinka.datum > pred_2_mesici and novinka.zverejneno %}
|
|
||||||
<p>
|
<p>
|
||||||
Tady bude novinka.
|
Tady bude novinka.
|
||||||
{{ novinka.text }}
|
{{ novinka.text }}
|
||||||
</p>
|
</p>
|
||||||
<img src='{{ novinka.obrazek }}'
|
<img src='{{ novinka.obrazek.url }}'
|
||||||
{% endif %}
|
|
||||||
{% endfor%}
|
{% endfor%}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
Trala!
|
|
||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
HU!
|
HU!
|
||||||
{% block novinky %}
|
{% block content %}
|
||||||
Tady bude nadpis pro novinky.
|
Tady bude nadpis pro novinky.
|
||||||
{% include 'novinky.html' %}
|
{% include 'seminar/novinky.html' %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -41,17 +41,11 @@ def TemataView(request):
|
||||||
class TitulniStranaView(generic.ListView):
|
class TitulniStranaView(generic.ListView):
|
||||||
model = Novinky
|
model = Novinky
|
||||||
template_name='seminar/titulnistrana.html'
|
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):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(TitulniStranaView, self).get_context_data(**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
|
return context
|
||||||
|
|
||||||
### Co je M&M
|
### Co je M&M
|
||||||
|
|
Loading…
Reference in a new issue