Answers for "django ninja "schema""

0

django ninja "schema"

# 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()
Posted by: Guest on October-14-2021
0

django ninja "schema"

# 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()
Posted by: Guest on October-14-2021

Python Answers by Framework

Browse Popular Code Answers by Language