Compare commits
4 Commits
1db30afc1a
...
018b7a052f
Author | SHA1 | Date | |
---|---|---|---|
018b7a052f | |||
663c4cff71 | |||
8bd4fafb17 | |||
6795a221da |
@ -58,10 +58,13 @@
|
||||
|
||||
|
||||
<footer>
|
||||
<div class="buttons">
|
||||
<a role="button" href="{% url 'month_view_ical' calendar.firstdate.year calendar.firstdate.month %}" >Exporter ical {% picto_from_name "calendar" %}</a>
|
||||
{% if calendar.today_in_calendar %}
|
||||
<a role="button" href="{% url 'aujourdhui' %}?{{ filter.get_url }}">Aujourd'hui</a>
|
||||
<a role="button" href="{% url 'cette_semaine' %}?{{ filter.get_url }}">Cette semaine</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</footer>
|
||||
</article>
|
||||
|
||||
|
@ -56,7 +56,7 @@ Semaine du {{ calendar.calendar_days_list.0.date|date|frdate }}
|
||||
|
||||
|
||||
<footer>
|
||||
<a role="button" href="{% url 'week_view_ical' day.year day %}" >Exporter ical {% picto_from_name "calendar" %}</a>
|
||||
<a role="button" href="{% url 'week_view_ical' year week %}" >Exporter ical {% picto_from_name "calendar" %}</a>
|
||||
{% if calendar.today_in_calendar %}
|
||||
<a role="button" href="{% url 'aujourdhui' %}?{{ filter.get_url }}">Aujourd'hui</a>
|
||||
{% endif %}
|
||||
|
@ -10,14 +10,15 @@ from .views import *
|
||||
|
||||
urlpatterns = [
|
||||
path("", home, name="home"),
|
||||
path("semaine/<int:year>/<int:week>/", week_view, name="week_view"),
|
||||
path("semaine/<int:year>/<int:week>?feed=ical", week_view_ical, name="week_view_ical"),
|
||||
path("mois/<int:year>/<int:month>/", month_view, name="month_view"),
|
||||
path("aujourdhui/", day_view, name="aujourdhui"),
|
||||
path("jour/<int:year>/<int:month>/<int:day>/", day_view, name="day_view"),
|
||||
path("jour/<int:year>/<int:month>/<int:day>?feed=ical", day_view_ical, name="day_view_ical"),
|
||||
path("aujourdhui/", day_view, name="aujourdhui"),
|
||||
path("cette-semaine/", week_view, name="cette_semaine"),
|
||||
path("semaine/<int:year>/<int:week>/", week_view, name="week_view"),
|
||||
path("semaine/<int:year>/<int:week>?feed=ical", week_view_ical, name="week_view_ical"),
|
||||
path("ce-mois-ci", month_view, name="ce_mois_ci"),
|
||||
path("mois/<int:year>/<int:month>/", month_view, name="month_view"),
|
||||
path("mois/<int:year>/<int:month>?feed=ical", month_view_ical, name="month_view_ical"),
|
||||
path("tag/<t>/", view_tag, name="view_tag"),
|
||||
path("tags/", tag_list, name="view_all_tags"),
|
||||
path("moderation/", moderation, name="moderation"),
|
||||
|
@ -267,7 +267,10 @@ def home(request):
|
||||
return week_view(request, home=True)
|
||||
|
||||
|
||||
def month_view(request, year=None, month=None):
|
||||
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:
|
||||
year = now.year
|
||||
@ -277,6 +280,10 @@ def month_view(request, year=None, month=None):
|
||||
filter = EventFilter(request.GET, queryset=get_event_qs(request), request=request)
|
||||
cmonth = CalendarMonth(year, month, filter)
|
||||
|
||||
if ical:
|
||||
response = Event.export_to_ics(f"Événements {cmonth.get_month_name()} {year}", cmonth.get_events())
|
||||
return response
|
||||
|
||||
context = {
|
||||
"year": year,
|
||||
"month": cmonth.get_month_name(),
|
||||
@ -301,11 +308,10 @@ def week_view(request, year=None, week=None, home=False, ical=False):
|
||||
cweek = CalendarWeek(year, week, filter)
|
||||
|
||||
if ical:
|
||||
logger.warning("export ical semaine")
|
||||
response = Event.export_to_ics("testsemaine", 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}
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user