Example #1
0
 def create(self, request, *args, **kwargs):
     """ We ensure the Thread only involves eligible participants. """
     serializer = self.get_serializer(data=compat_get_request_data(request))
     compat_serializer_check_is_valid(serializer)
     self.perform_create(request, serializer)
     headers = self.get_success_headers(serializer.data)
     return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)
 def create(self, request, *args, **kwargs):
     """ We ensure the Thread only involves eligible participants. """
     serializer = self.get_serializer(data=compat_get_request_data(request))
     compat_serializer_check_is_valid(serializer)
     self.perform_create(request, serializer)
     headers = self.get_success_headers(serializer.data)
     return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)
Example #3
0
 def update(self, request, *args, **kwargs):
     participants_ids = compat_get_request_data(self.request).getlist('participants', [])
     if len(participants_ids) > 0:
         # we warn the user he cannot update the participants here
         return Response("Participant updates not allowed by this method.", status=status.HTTP_400_BAD_REQUEST)
     partial = kwargs.pop('partial', False)
     instance = self.get_object()
     serializer = self.get_serializer(instance, data=compat_get_request_data(request), partial=partial)
     compat_serializer_check_is_valid(serializer)
     try:
         self.perform_update(serializer)
     except:
         compat_perform_update(self, serializer)
     return Response(serializer.data)
 def update(self, request, *args, **kwargs):
     participants_ids = compat_get_request_data(self.request).getlist('participants', [])
     if len(participants_ids) > 0:
         # we warn the user he cannot update the participants here
         return Response("Participant updates not allowed by this method.", status=status.HTTP_400_BAD_REQUEST)
     partial = kwargs.pop('partial', False)
     instance = self.get_object()
     serializer = self.get_serializer(instance, data=compat_get_request_data(request), partial=partial)
     compat_serializer_check_is_valid(serializer)
     try:
         self.perform_update(serializer)
     except:
         compat_perform_update(self, serializer)
     return Response(serializer.data)