2
you will have to override the to_representation method on your list serializer class
define a list serializer class:
class StoreRotationListSerializer(serializers.ListSerializer):
def to_representation(self, data):
repr = super(StoreRotationListSerializer, self).to_representation(data)
return {'data': repr}
now use this list serializer class in your main serializer:
class Store_RotationSerializer(ModelSerializer):
class Meta:
model = Store_Rotation
fields = '__all__'
list_serializer_class = StoreRotationListSerializer
read more about list serializer here: http://www.django-rest-framework.org/api-guide/serializers/#listserializer
0
- [Answered ]-Can a parent class check if child class has such field?
- [Answered ]-Django Rest Framework โ Nested Serialization with intermediary model
- [Answered ]-Environment can only contain strings- wagtail CMS, Django
- [Answered ]-Django Editable Text Field
- [Answered ]-How do you add a unique field (non empty) field to an existing model in Django?
Source:stackexchange.com