@@ -94,14 +94,19 @@ class ExampleValidatedSerializer(serializers.Serializer):
94
94
ip4 = serializers .IPAddressField (protocol = 'ipv4' )
95
95
ip6 = serializers .IPAddressField (protocol = 'ipv6' )
96
96
ip = serializers .IPAddressField ()
97
+ float_list = serializers .ListField (child = serializers .FloatField ())
98
+ string_list = serializers .ListField (child = serializers .CharField ())
99
+ boolean_list = serializers .ListField (child = serializers .BooleanField (), default = [True , False ])
97
100
98
101
99
102
class ExampleValidatedAPIView (generics .GenericAPIView ):
100
103
serializer_class = ExampleValidatedSerializer
101
104
102
105
def get (self , * args , ** kwargs ):
103
- serializer = self .get_serializer (integer = 33 , string = 'hello' , regex = 'foo' , decimal1 = 3.55 ,
104
- decimal2 = 5.33 ,
email = '[email protected] ' ,
105
- url = 'http://localhost' , uuid = uuid .uuid4 (), ip4 = '127.0.0.1' , ip6 = '::1' ,
106
- ip = '192.168.1.1' )
106
+ serializer = self .get_serializer (
107
+ integer = 33 , string = 'hello' , regex = 'foo' , decimal1 = 3.55 , decimal2 = 5.33 ,
108
+ email = '[email protected] ' ,
url = 'http://localhost' ,
uuid = uuid .
uuid4 (),
ip4 = '127.0.0.1' ,
109
+ ip6 = '::1' , ip = '192.168.1.1' , float_list = [1.0 , 2.0 ], string_list = ['a' , 'b' , 'c' ],
110
+ boolean_list = [True ]
111
+ )
107
112
return Response (serializer .data )
0 commit comments