I have two serializers set up as
class LineChartDataSerializer(serializers.ModelSerializer):
class Meta:
model = LineChartData
fields = ('date','price')
# order_by = (('date',))
# ordering = ['-date']
class CompanyForLineChartsSerializer(serializers.ModelSerializer):
data = LineChartDataSerializer(many=True, source='linechartdata_set')
class Meta:
model = CompanyForLineCharts
fields = ('company', 'data')
So I have tried both the ways to order the output but nothing works.
Sometimes the json order gets fine(ie chronological order) but most of the
times, the is not the right order, in fact it does not have any order. Data
is stored in a chronological order in the database(verified that). The
database I am using is Postgresql(should not be a problem I think). What is
and where is wrong? Any input will be helpful. I THINK it's a drf bug.
Anyway, thanks.
--
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.