Skip to content
Snippets Groups Projects
Commit fd0b8982 authored by Benjamin Hättasch's avatar Benjamin Hättasch Committed by Nadja Geisler
Browse files

Fix API detail views

Previously, the event from the url was not parsed correctly for API endpoints for individual AKs, AKRooms, etc. This led to self.event being None and the queryset being empty, hence the AK, AKRoom etc. could not be found by the API. This fix makes sure, the event is loaded as part of the API initialization for all endpoints and methods.
parent 42f4957c
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,11 @@ class EventSlugMixin:
self._load_event()
return super().create(request, *args, **kwargs)
def initial(self, request, *args, **kwargs):
if self.event is None:
self._load_event()
super().initial(request, *args, **kwargs)
def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(object_list=object_list, **kwargs)
# Add event to context (to make it accessible in templates)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment