Changed history in products url to reflect quantity and date timestamp

This commit is contained in:
keannu125 2023-03-07 17:47:50 +08:00
parent 17495c960b
commit 9c8889df0e

View file

@ -7,7 +7,7 @@ class HistoricalRecordField(serializers.ListField):
child = serializers.DictField() child = serializers.DictField()
def to_representation(self, data): def to_representation(self, data):
return super().to_representation(data.values('id', 'history_date').order_by('history_date')) return super().to_representation(data.values('quantity', 'history_date').order_by('history_date'))
class ProductSerializer(serializers.HyperlinkedModelSerializer): class ProductSerializer(serializers.HyperlinkedModelSerializer):