Compare commits

...

4 Commits

Author SHA1 Message Date
018b7a052f 13 amélioration des noms de fichiers 2024-05-19 17:09:25 +02:00
663c4cff71 réorganisation ordre des urls dates 2024-05-19 17:08:55 +02:00
8bd4fafb17 13 export mois 2024-05-19 16:59:13 +02:00
6795a221da 13 export semaine 2024-05-19 16:30:50 +02:00
4 changed files with 23 additions and 13 deletions

View File

@ -58,10 +58,13 @@
<footer>
{% 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 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>

View File

@ -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 %}

View File

@ -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"),

View File

@ -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)