fix export for recurrent events

This commit is contained in:
Jean-Marie Favreau 2024-06-01 10:52:24 +02:00
parent 1a52d02141
commit bf043f954d
3 changed files with 7 additions and 3 deletions

View File

@ -71,7 +71,7 @@
</p>
</div>
<div class="buttons">
<a href="{% url 'export_event_ical' event.id %}" role="button">Exporter ical {% picto_from_name "calendar" %}</a>
<a href="{% url 'export_event_ical' event.start_day.year event.start_day.month event.start_day.day event.id %}" role="button">Exporter ical {% picto_from_name "calendar" %}</a>
{% if perms.agenda_culturel.change_event and not noedit %}
{% include "agenda_culturel/edit-buttons-inc.html" with event=event %}
{% endif %}

View File

@ -158,7 +158,10 @@ urlpatterns = [
UnknownPlaceAddView.as_view(),
name="add_place_to_event",
),
path("event/<int:pk>", export_event_ical, name="export_event_ical"),
path(
"event/<int:year>/<int:month>/<int:day>/<int:pk>/ical",
export_event_ical,
name="export_event_ical"),
]
if settings.DEBUG:

View File

@ -598,8 +598,9 @@ def import_from_url(request):
)
def export_event_ical(request, pk):
def export_event_ical(request, year, month, day, pk):
event = get_object_or_404(Event, pk=pk)
event = event.get_recurrence_at_date(year, month, day)
events = list()
events.append(event)