diff --git a/src/agenda_culturel/calendar.py b/src/agenda_culturel/calendar.py index 851ed5f..4b7e2b2 100644 --- a/src/agenda_culturel/calendar.py +++ b/src/agenda_culturel/calendar.py @@ -432,13 +432,19 @@ class CalendarList: class CalendarMonth(CalendarList): - def __init__(self, year, month, filter, qs=None): + def __init__(self, year, month, filter, qs=None, day=None): self.year = year self.month = month + self.day = day r = calendar.monthrange(year, month) - first = date(year, month, 1) - last = date(year, month, r[1]) + if self.day is None: + first = date(year, month, 1) + last = date(year, month, r[1]) + else: + first = date(year, month, day) + last = first + timedelta(days=28) + last = last + timedelta(days=6 - last.weekday()) super().__init__(first, last, filter, qs) diff --git a/src/agenda_culturel/templates/agenda_culturel/page-month.html b/src/agenda_culturel/templates/agenda_culturel/page-month.html index b5ada27..90d94b8 100644 --- a/src/agenda_culturel/templates/agenda_culturel/page-month.html +++ b/src/agenda_culturel/templates/agenda_culturel/page-month.html @@ -15,27 +15,45 @@ {% endblock %} {% endblock %} {% block navigation-menu %} - {% cache 90000 navigation_links_month user.is_authenticated calendar.firstdate category filter.get_url %} + {% cache 90000 navigation_links_month user.is_authenticated calendar.firstdate this_month category filter.get_url %} {% navigation_links filter category calendar "month" %} {% endcache %} {% endblock %} {% block when_parameters %}{{ filter.get_url }}{% endblock %} {% block content %} {% with cache_timeout=user.is_authenticated|yesno:"30,6000" %} - {% cache cache_timeout month user.is_authenticated calendar.firstdate category filter.get_url %} + {% cache cache_timeout month user.is_authenticated calendar.firstdate this_month category filter.get_url %} {% include "agenda_culturel/filter-inc.html" with filter=filter noarticle=0 %}