0
を返却はAttributeError、およびORMなどpeewe。私は私のAPIのため<strong>sanic</strong>を使用していたクラス
と私はJSONレスポンスのためのヘルパーを作成したいが、私は
from sanic.response import json
class JsonResponse:
def __init__(self, model, all_records=None):
self.model = self._model_query(model)
self.all_records = all_records
def _model_query(self, model):
if self.all_records:
records = json({model: list(model)})
else:
records = {}
return records