From 0c283e4ae0cd26e910f1a9f2270a75b6cd64ffdd Mon Sep 17 00:00:00 2001 From: SebF Date: Fri, 3 May 2024 18:54:07 +0200 Subject: [PATCH] first poc --- .../agenda_culturel/single-event/event-single-inc.html | 7 ++++--- src/agenda_culturel/urls.py | 1 + src/agenda_culturel/views.py | 8 ++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html b/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html index fe179b6..ce14523 100644 --- a/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html +++ b/src/agenda_culturel/templates/agenda_culturel/single-event/event-single-inc.html @@ -70,11 +70,12 @@ {% endif %}

- {% if perms.agenda_culturel.change_event and not noedit %}
- {% include "agenda_culturel/edit-buttons-inc.html" with event=event %} + Exporter ical {% picto_from_name "calendar" %} + {% if perms.agenda_culturel.change_event and not noedit %} + {% include "agenda_culturel/edit-buttons-inc.html" with event=event %} + {% endif %}
- {% endif %} diff --git a/src/agenda_culturel/urls.py b/src/agenda_culturel/urls.py index e526ff3..9ff32f5 100644 --- a/src/agenda_culturel/urls.py +++ b/src/agenda_culturel/urls.py @@ -158,6 +158,7 @@ urlpatterns = [ UnknownPlaceAddView.as_view(), name="add_place_to_event", ), + path("event/", export_event_ical, name="export_event_ical"), ] if settings.DEBUG: diff --git a/src/agenda_culturel/views.py b/src/agenda_culturel/views.py index 15ba308..ef3c06a 100644 --- a/src/agenda_culturel/views.py +++ b/src/agenda_culturel/views.py @@ -598,6 +598,14 @@ def import_from_url(request): ) +def export_event_ical(request, pk): + event = get_object_or_404(Event, pk=pk) + logger = logging.getLogger(__name__) + logger.info("titre event" + event.title) + + return HttpResponse(event.title + ".ical", content_type="text/calendar") + + class EventFilterAdmin(django_filters.FilterSet): status = django_filters.MultipleChoiceFilter( choices=Event.STATUS.choices, widget=forms.CheckboxSelectMultiple