ajout de facilitateurs de navigation
This commit is contained in:
parent
036f07073d
commit
1672fbaf67
@ -49,6 +49,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
{% if calendar.today_in_calendar %}
|
||||||
|
<a role="button" href="{% url 'aujourdhui' %}">Aujourd'hui</a>
|
||||||
|
<a role="button" href="{% url 'cette_semaine' %}">Cette semaine</a>
|
||||||
|
{% endif %}
|
||||||
|
</footer>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
</hgroup>
|
</hgroup>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
<header>
|
<header>
|
||||||
<div class="navigation">
|
<div class="navigation">
|
||||||
@ -54,11 +52,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<p>Voir aussi tous les événements du mois de
|
{% if calendar.today_in_calendar %}
|
||||||
<a href="{% url 'month_view' calendar.firstdate.year calendar.firstdate.month %}">{{ calendar.firstdate | date:"F o" }}</a>{% if calendar.firstdate.month != calendar.lastdate.month %}
|
<a role="button" href="{% url 'aujourdhui' %}">Aujourd'hui</a>
|
||||||
ou tous les événements du mois de <a href="{% url 'month_view' calendar.lastdate.year calendar.lastdate.month %}">{{ calendar.lastdate | date:"F o" }}</a>
|
{% endif %}
|
||||||
{% endif %}.</p>
|
<a role="button" href="{% url 'month_view' calendar.firstdate.year calendar.firstdate.month %}">{{ calendar.firstdate | date:"F o" }}</a>
|
||||||
</footer>
|
{% if calendar.firstdate.month != calendar.lastdate.month %}
|
||||||
|
<a role="button" href="{% url 'month_view' calendar.lastdate.year calendar.lastdate.month %}">{{ calendar.lastdate | date:"F o" }}</a>
|
||||||
|
{% endif %}
|
||||||
|
</footer>
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,6 +76,12 @@ class CalendarList:
|
|||||||
self.fill_calendar_days()
|
self.fill_calendar_days()
|
||||||
|
|
||||||
|
|
||||||
|
def today_in_calendar(self):
|
||||||
|
for d in self.calendar_days.values():
|
||||||
|
if not d.is_today():
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def all_in_past(self):
|
def all_in_past(self):
|
||||||
for d in self.calendar_days.values():
|
for d in self.calendar_days.values():
|
||||||
if not d.is_in_past():
|
if not d.is_in_past():
|
||||||
@ -151,41 +157,40 @@ class CalendarWeek(CalendarList):
|
|||||||
|
|
||||||
def home(request):
|
def home(request):
|
||||||
return week_view(request)
|
return week_view(request)
|
||||||
#return month_view(request, now.year, now.month)
|
|
||||||
|
|
||||||
def month_view(request, year = None, month = None):
|
def month_view(request, year = None, month = None):
|
||||||
# TODO: filter by category, tag
|
# TODO: filter by category, tag
|
||||||
now = date.today()
|
now = date.today()
|
||||||
if year == None:
|
if year is None:
|
||||||
year = now.year
|
year = now.year
|
||||||
if month == None:
|
if month is None:
|
||||||
month = now.month
|
month = now.month
|
||||||
cmonth = CalendarMonth(year, month)
|
cmonth = CalendarMonth(year, month)
|
||||||
|
|
||||||
context = {"year": year, "month": cmonth.get_month_name(), "calendar": cmonth }
|
context = {"year": year, "month": cmonth.get_month_name(), "calendar": cmonth}
|
||||||
return render(request, 'agenda_culturel/page-month.html', context)
|
return render(request, 'agenda_culturel/page-month.html', context)
|
||||||
|
|
||||||
|
|
||||||
def week_view(request, year = None, week = None):
|
def week_view(request, year = None, week = None):
|
||||||
now = date.today()
|
now = date.today()
|
||||||
if year == None:
|
if year is None:
|
||||||
year = now.year
|
year = now.year
|
||||||
if week == None:
|
if week is None:
|
||||||
week = now.isocalendar()[1]
|
week = now.isocalendar()[1]
|
||||||
|
|
||||||
cweek = CalendarWeek(year, week)
|
cweek = CalendarWeek(year, week)
|
||||||
|
|
||||||
context = {"year": year, "week": week, "calendar": cweek }
|
context = {"year": year, "week": week, "calendar": cweek}
|
||||||
return render(request, 'agenda_culturel/page-week.html', context)
|
return render(request, 'agenda_culturel/page-week.html', context)
|
||||||
|
|
||||||
|
|
||||||
def day_view(request, year = None, month = None, day = None):
|
def day_view(request, year = None, month = None, day = None):
|
||||||
now = date.today()
|
now = date.today()
|
||||||
if year == None:
|
if year is None:
|
||||||
year = now.year
|
year = now.year
|
||||||
if month == None:
|
if month is None:
|
||||||
month = now.month
|
month = now.month
|
||||||
if day == None:
|
if day is None:
|
||||||
day = now.day
|
day = now.day
|
||||||
|
|
||||||
day = date(year, month, day)
|
day = date(year, month, day)
|
||||||
|
Loading…
Reference in New Issue
Block a user