first poc

This commit is contained in:
SebF 2024-05-03 18:54:07 +02:00
parent 4f80d00485
commit 0c283e4ae0
3 changed files with 13 additions and 3 deletions

View File

@ -70,11 +70,12 @@
{% endif %} {% endif %}
</p> </p>
</div> </div>
{% if perms.agenda_culturel.change_event and not noedit %}
<div class="buttons"> <div class="buttons">
{% include "agenda_culturel/edit-buttons-inc.html" with event=event %} <a href="{% url 'export_event_ical' 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 %}
</div> </div>
{% endif %}
</footer> </footer>
</article> </article>

View File

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

View File

@ -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): class EventFilterAdmin(django_filters.FilterSet):
status = django_filters.MultipleChoiceFilter( status = django_filters.MultipleChoiceFilter(
choices=Event.STATUS.choices, widget=forms.CheckboxSelectMultiple choices=Event.STATUS.choices, widget=forms.CheckboxSelectMultiple