P-70 fix
This commit is contained in:
1 parent
069189a1dc
commit
0f8588fc0f
4 files changed
+19
-1
No files matched your search
@@ -2,6 +2,8 @@ from rest_framework import serializers
|
||||
from .models import *
|
||||
from about_inspection.models import *
|
||||
from userauth.serializers import *
|
||||
class IdonlynotRequieredSerializer(serializers.Serializer):
|
||||
id = serializers.IntegerField(required=False)
|
||||
|
||||
class CalendarParticipantsSerializer(serializers.ModelSerializer):
|
||||
""" Сериализатор участников календаря """
|
||||
|
||||
@@ -8,5 +8,6 @@ urlpatterns = [
|
||||
path('get_employees/', GetEmployees.as_view(), name='get_employees'),
|
||||
path('my_calendars/', MyCalendars.as_view(), name='get_calendars'),
|
||||
path('exclusion_dates/', ExclusionDatesAPIView.as_view(), name='exclusion_dates'),
|
||||
path('my_events/', MyEvents.as_view(), name='myvents')
|
||||
# path('createEvents/', CreateEventsAPIView.as_view(), name='createEvents')
|
||||
]
|
||||
@@ -86,3 +86,16 @@ class GetEmployees(APIView):
|
||||
return Response(EmployeeSerializer(queryset, many=True).data)
|
||||
|
||||
|
||||
|
||||
class MyEvents(APIView):
|
||||
@swagger_auto_schema(query_serializer=IdonlynotRequieredSerializer)
|
||||
def get(self, request):
|
||||
eventid = request.query_params.get("id")
|
||||
result = []
|
||||
if eventid is None:
|
||||
calendars = Calendar.objects.filter(Q(get_participants__participant_calendar__id=request.user.user.id) | Q(author__id=request.user.user.id)).distinct()
|
||||
else:
|
||||
pass
|
||||
|
||||
|
||||
return Response(result)
|
||||
Reference in new issue
Block a user