add _default clarification in docs

This commit is contained in:
collerek
2022-03-28 12:57:48 +02:00
parent cd6d9c85af
commit 1b4daa2c01

View File

@ -63,6 +63,9 @@ Combination of create and get methods.
Tries to get a row meeting the criteria and if `NoMatch` exception is raised it creates
a new one with given kwargs and _defaults.
When `_defaults` dictionary is provided the values set in `_defaults` will **always** be set, including overwriting explicitly provided values.
i.e. `get_or_create(_defaults: {"title": "I win"}, title="never used")` will always use "I win" as title whether you provide your own value in kwargs or not.
```python
class Album(ormar.Model):
class Meta:
@ -187,4 +190,4 @@ from other side of the relation.
[models-save]: ../models/methods.md#save
[models-upsert]: ../models/methods.md#upsert
[models-save-related]: ../models/methods.md#save_related
[querysetproxy]: ../relations/queryset-proxy.md
[querysetproxy]: ../relations/queryset-proxy.md