def local_events(request, employee_id):
"""
Returns the full upcoming events list for employee location
---
serializer: events.serializers.EventSerializer
responseMessages:
- code: 401
message: Unauthorized. Authentication credentials were not provided. Invalid token.
- code: 403
message: Forbidden.
- code: 404
message: Not found
"""
if request.method == 'GET':
employee = get_object_or_404(Employee, pk=employee_id)
events = Event.objects.filter(location=employee.location, is_active=True)
paginator = PageNumberPagination()
results = paginator.paginate_queryset(events, request)
serializer = EventSerializer(results, many=True)
return paginator.get_paginated_response(serializer.data)
评论列表
文章目录