Exemple #1
0
 def put(self, request, format=None):
     email = request.GET.get('email', False)
     places = self.get_object(email)
     serializer = PlacesSerializers(places, data=request.data)
     if serializer.is_valid():
         serializer.save()
         return Response(serializer.data)
     return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
Exemple #2
0
 def post(self, request, format=None):
     serializer = PlacesSerializers(data=request.data)
     if serializer.is_valid():
         serializer.save()
         return Response(serializer.data, content_type='application/json', status=status.HTTP_201_CREATED)
     return Response(serializer.errors, content_type='application/json', status=status.HTTP_400_BAD_REQUEST)