📌  相关文章
📜  django ninja "schema" - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:04.185000             🧑  作者: Mango

代码示例1
# in viwes

# make sure you import Schema from ninja
from ninja import Schema

# make your class inharted from Schema
class DataSchema(Schema) :
    name: str
    age: int
    part_of: 'DataSchema' = None 

# update class
DataSchema.update_forward_refs()

# example 
@account_controlear.post("")
def create_account(request, data_indax: DataSchema):
    return data_indax.dict()