Correct spelling mistakes (#1163)
Co-authored-by: collerek <collerek@gmail.com>
This commit is contained in:
@ -37,7 +37,7 @@ class User(ormar.Model):
|
||||
category: str = ormar.String(max_length=255, default="User")
|
||||
```
|
||||
|
||||
In above example fields `id` (is an `autoincrement` `Integer`), `first_name` ( has `nullable=True`) and `category` (has `default`) are optional and can be skipped in response and model wil still validate.
|
||||
In above example fields `id` (is an `autoincrement` `Integer`), `first_name` ( has `nullable=True`) and `category` (has `default`) are optional and can be skipped in response and model will still validate.
|
||||
|
||||
If the field is nullable you don't have to include it in payload during creation as well as in response, so given example above you can:
|
||||
|
||||
@ -75,9 +75,9 @@ async def create_user3(user: RequestUser): # use the generated model here
|
||||
!!!Warning
|
||||
The `get_pydantic` method generates all models in a tree of nested models according to an algorithm that allows to avoid loops in models (same algorithm that is used in `dict()`, `select_all()` etc.)
|
||||
|
||||
That means that nested models won't have reference to parent model (by default ormar relation is biderectional).
|
||||
That means that nested models won't have reference to parent model (by default ormar relation is bidirectional).
|
||||
|
||||
Note also that if given model exists in a tree more than once it will be doubled in pydantic models (each occurance will have separate own model). That way you can exclude/include different fields on different leafs of the tree.
|
||||
Note also that if given model exists in a tree more than once it will be doubled in pydantic models (each occurrence will have separate own model). That way you can exclude/include different fields on different leafs of the tree.
|
||||
|
||||
#### Mypy and type checking
|
||||
|
||||
@ -140,4 +140,4 @@ async def create_user3(user: UserCreate): # use pydantic model here
|
||||
# note how now request param is a pydantic model and not the ormar one
|
||||
# so you need to parse/convert it to ormar before you can use database
|
||||
return await User(**user.dict()).save()
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user