本文整理汇总了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