Ejemplo n.º 1
0
 def list(self, request):
     ship = request.GET.get('ship')
     names = transform(request.GET.get('name'))
     names = names.split()
     queryset = Deck.objects.all()
     for name in names:
         queryset = queryset.filter(name__icontains=name, ship=ship)
     if not queryset.exists():
         queryset = Deck.objects.filter(name='Other', ship=5)
     serializer = DeckSerializer(queryset, many=True)
     # serializer = DeckSerializer(queryset.first())
     return Response(serializer.data)
Ejemplo n.º 2
0
 def test_number(self):
     self.assertEqual(1, transform(self.number1))
     self.assertEqual(22, transform(self.number2))
     self.assertEqual(157, transform(self.number3))
     self.assertEqual(999999, transform(self.number4))
     self.assertEqual('bla bla bla', transform(self.number5))
Ejemplo n.º 3
0
 def test_number(self):
     self.assertEqual(1, transform(self.number1))
     self.assertEqual(22, transform(self.number2))
     self.assertEqual(157, transform(self.number3))
     self.assertEqual(999999, transform(self.number4))
     self.assertEqual('bla bla bla', transform(self.number5))