Flat list of values in nested serializers

2018-03-07 Thread Kishor Pawar
Say I have serializers as below. class AbcSerializer(serializers.ModelSerializer): class Meta: model = Abc fields = ('a',) # there could be other fields too in model. class XyzSerializer(serializers.ModelSerializer): a = AbcSerializer(many=True) class Meta:

More streamlined declaration of nested serializer using Django's double underscore convention

2018-03-07 Thread Leon Sasson
Hello, I've been writing a few NestedSerializers lately, and coming across as having too much unnecessary boilerplate. I think there's an opportunity to streamline in a way to serves almost the same use case, but vastly simplified. Best demonstrated with an example: Suppose I have the followin