def put(self, request, wordEN, typeEN, wordSP, typeSP, category, format=None):
     word = self.get_object(wordEN, wordSP, typeEN, typeSP, category)
     serializer = WordTranslationsSerializer(word, data=request.data)
     if serializer.is_valid():
         serializer.save()
         return Response(serializer.data)
     return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
 def post(self, request, format=None):
     serializer = WordTranslationsSerializer(data=request.data)
     if serializer.is_valid():
         self.perform_create(serializer)
         serializer.save()
         return Response(serializer.data, status=status.HTTP_201_CREATED)
     return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
Beispiel #3
0
 def post(self, request, format=None):
     serializer = WordTranslationsSerializer(data=request.data)
     if serializer.is_valid():
         self.perform_create(serializer)
         serializer.save()
         return Response(serializer.data, status=status.HTTP_201_CREATED)
     return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
Beispiel #4
0
 def put(self,
         request,
         wordEN,
         typeEN,
         wordSP,
         typeSP,
         category,
         format=None):
     word = self.get_object(wordEN, wordSP, typeEN, typeSP, category)
     serializer = WordTranslationsSerializer(word, data=request.data)
     if serializer.is_valid():
         serializer.save()
         return Response(serializer.data)
     return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
Beispiel #5
0
 def get(self, request, wordEN, format=None):
     words = self.get_objects(wordEN)
     serializer = WordTranslationsSerializer(words, many=True)
     return Response(serializer.data)
Beispiel #6
0
 def get(self, request, format=None):
     words = WordTranslations.objects.all()
     serializer = WordTranslationsSerializer(words, many=True)
     #print(request.user.__str__()) #Para probar la autenticación por cookie
     return Response(serializer.data)