本文整理匯總了Python中pydantic.constr方法的典型用法代碼示例。如果您正苦於以下問題:Python pydantic.constr方法的具體用法?Python pydantic.constr怎麽用?Python pydantic.constr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pydantic
的用法示例。
在下文中一共展示了pydantic.constr方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import pydantic [as 別名]
# 或者: from pydantic import constr [as 別名]
def __init__(self, allow_extra):
class Model(BaseModel):
id: int
client_name: constr(max_length=255)
sort_index: float
# client_email: EmailStr = None
client_phone: constr(max_length=255) = None
class Location(BaseModel):
latitude: float = None
longitude: float = None
location: Location = None
contractor: PositiveInt = None
upstream_http_referrer: constr(max_length=1023) = None
grecaptcha_response: constr(min_length=20, max_length=1000)
last_updated: datetime = None
class Skill(BaseModel):
subject: str
subject_id: int
category: str
qual_level: str
qual_level_id: int
qual_level_ranking: float = 0
skills: List[Skill] = []
class Config:
extra = Extra.allow if allow_extra else Extra.forbid
self.model = Model