diff --git a/src/agenda_culturel/urls.py b/src/agenda_culturel/urls.py index dc82b43..c47bfb4 100644 --- a/src/agenda_culturel/urls.py +++ b/src/agenda_culturel/urls.py @@ -12,13 +12,21 @@ urlpatterns = [ path("", home, name="home"), path("aujourdhui/", day_view, name="aujourdhui"), path("jour////", day_view, name="day_view"), - path("jour///?feed=ical", day_view_ical, name="day_view_ical"), + path( + "jour///?feed=ical", + day_view_ical, + name="day_view_ical", + ), path("cette-semaine/", week_view, name="cette_semaine"), path("semaine///", week_view, name="week_view"), - path("semaine//?feed=ical", week_view_ical, name="week_view_ical"), + path( + "semaine//?feed=ical", week_view_ical, name="week_view_ical" + ), path("ce-mois-ci", month_view, name="ce_mois_ci"), path("mois///", month_view, name="month_view"), - path("mois//?feed=ical", month_view_ical, name="month_view_ical"), + path( + "mois//?feed=ical", month_view_ical, name="month_view_ical" + ), path("tag//", view_tag, name="view_tag"), path("tags/", tag_list, name="view_all_tags"), path("moderation/", moderation, name="moderation"), diff --git a/src/agenda_culturel/views.py b/src/agenda_culturel/views.py index d0292ab..0317502 100644 --- a/src/agenda_culturel/views.py +++ b/src/agenda_culturel/views.py @@ -269,7 +269,8 @@ def home(request): def month_view_ical(request, year=None, month=None): return month_view(request, year, month, True) - + + def month_view(request, year=None, month=None, ical=False): now = date.today() if year is None: @@ -281,7 +282,9 @@ def month_view(request, year=None, month=None, ical=False): cmonth = CalendarMonth(year, month, filter) if ical: - response = Event.export_to_ics(f"Événements {cmonth.get_month_name()} {year}", cmonth.get_events()) + response = Event.export_to_ics( + f"Événements {cmonth.get_month_name()} {year}", cmonth.get_events() + ) return response context = { @@ -308,10 +311,18 @@ def week_view(request, year=None, week=None, home=False, ical=False): cweek = CalendarWeek(year, week, filter) if ical: - response = Event.export_to_ics(f"Événements semaine {week} {year}", cweek.get_events()) + response = Event.export_to_ics( + f"Événements semaine {week} {year}", cweek.get_events() + ) return response - context = {"year": year, "week": week, "calendar": cweek, "filter": filter, "ical": True} + context = { + "year": year, + "week": week, + "calendar": cweek, + "filter": filter, + "ical": True, + } if home: context["home"] = 1 return render(request, "agenda_culturel/page-week.html", context)