Skip to content

Commit

Permalink
document ability to use Field() in create_model() (#1492)
Browse files Browse the repository at this point in the history
  • Loading branch information
xlotlu committed Jun 27, 2020
1 parent f85afab commit e038f11
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pydantic/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,8 +796,10 @@ def create_model(
:param __config__: config class to use for the new model
:param __base__: base class for the new model to inherit from
:param __validators__: a dict of method names and @validator class methods
:param **field_definitions: fields of the model (or extra fields if a base is supplied) in the format
`<name>=(<type>, <default default>)` or `<name>=<default value> eg. `foobar=(str, ...)` or `foobar=123`
:param **field_definitions: fields of the model (or extra fields if a base is supplied)
in the format `<name>=(<type>, <default default>)` or `<name>=<default value>, e.g.
`foobar=(str, ...)` or `foobar=123`, or, for complex use-cases, in the format
`<name>=<FieldInfo>`, e.g. `foo=Field(default_factory=datetime.utcnow, alias='bar')`
"""
if __base__:
if __config__ is not None:
Expand Down

0 comments on commit e038f11

Please sign in to comment.