def get(self, request, format=None, id=None): obj = self.get_object() serializer = ProductStatSerializer( {"stats": { "2019-01-01": [5, 10, 15], "2019-01-02": [20, 1, 1], }}) return Response(serializer.data)
def get(self, request, format=None, id=None): obj = self.get_object() serializer = ProductStatSerializer( {'stats': { '2019-01-01': [3, 5, 7], '2019-05-07': [12, 15, 47], }}) return Response(serializer.data)
def get(self, request, format=None, id=None): obj = self.get_object() serializer = ProductStatSerializer( {'stats': { '2019-01-01': [5, 10, 15], '2019-01-02': [20, 1, 1] }}) return Response(serializer.data)
def get(self, request, id, format=None): product = self.get_object() # 固定データモデルと1-1で対応しない場合に利用するcomposite field serializer = ProductStatSerializer( {'stats': { '2019-01-01': [5, 10, 15], '2019-01-02': [20, 1, 1], }}) return Response(serializer.data)
def get(self, request, format=None, id=None): obj = self.get_object() serializer = ProductStatSerializer({ "stats": { "29-01-2020": [12, 21, 21, 12], "09-11-2020": [12, 33, 44, 55] } }) return Response(serializer.data)
def get(self, request, format=None, id=None): obj = self.get_object() serializer = ProductStatSerializer({ 'stats': { '2020-07-07': [5, 29, 9, 8], '2020-07-010': [3, 5, 34, 89], } }) return Response(serializer.data)