Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
サーバーからの応答を CREATE および UPDATE 要求に対してのみ変更する方法はありますか?
{ "root": [ { "field1": "value1", "field2": "value2", "field3": "value3", "id": 12 ], "success": true }
それ以外の:
{ "field1": "value1", "field2": "value2", "field3": "value3", "id": 12 }
このようなコードで同じことをしました
class MyModel: class Meta: ... def alter_detail_data_to_serialize(self, request, to_be_serialized): return {"myRoot": to_be_serialized}