Verified Commit 2954ceb5 authored by Gijs Hendriksen's avatar Gijs Hendriksen Committed by Sébastiaan Versteeg
Browse files

Added viewset for retrieving next two days with events

parent c21f838f
......@@ -52,6 +52,21 @@ class EventViewset(viewsets.ReadOnlyModelViewSet):
return Response(serializer.data)
@list_route()
def shortlist(self, request):
days = Event.objects.filter(
end__gte=timezone.datetime.now(), published=True
).datetimes('start', 'day')[:2]
data = list(map(lambda day: EventListSerializer(Event.objects.filter(
start__day=day.day,
start__month=day.month,
start__year=day.year,
published=True,
), many=True, context={'request': request}).data, days))
return Response(data)
@list_route(permission_classes=[])
def calendarjs(self, request):
end, start = _extract_date_range(request)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment