I did not post it here to make the code more complex but I am performing 
some validations.I understand that it works with the Nested serializers but 
I need to understand what am I doing wrong that it is not working with a 
ListField

On Thursday, 27 September 2018 18:14:59 UTC+5:30, 
[email protected] wrote:
>
> You don't need to use a ListField if you're not going to validate, and by 
> not passing a child parameter you are indeed not validating the items in 
> the list.  
>
> http://www.django-rest-framework.org/api-guide/fields/#listfield
>
> If all you want to do is return the list of things in the many-to-many, 
> you don't need to explicitly specify the field in a model serializer.  You 
> can, however, use a nested a serializer, which is probably more appropriate 
> in this case:
>
> class IPGroupCreateSerializer(serializers.ModelSerializer):
>     ips = IPSerializer(read_only=True, many=True)
>
> If you want to used the nested serializer for deserialization as well, 
> then you will need to also implemented an update method in your 
> IPGroupCreateSerializer.
>
>
> http://www.django-rest-framework.org/api-guide/relations/#writable-nested-serializers
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to