add _default clarification in docs
This commit is contained in:
@ -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
|
Tries to get a row meeting the criteria and if `NoMatch` exception is raised it creates
|
||||||
a new one with given kwargs and _defaults.
|
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
|
```python
|
||||||
class Album(ormar.Model):
|
class Album(ormar.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -187,4 +190,4 @@ from other side of the relation.
|
|||||||
[models-save]: ../models/methods.md#save
|
[models-save]: ../models/methods.md#save
|
||||||
[models-upsert]: ../models/methods.md#upsert
|
[models-upsert]: ../models/methods.md#upsert
|
||||||
[models-save-related]: ../models/methods.md#save_related
|
[models-save-related]: ../models/methods.md#save_related
|
||||||
[querysetproxy]: ../relations/queryset-proxy.md
|
[querysetproxy]: ../relations/queryset-proxy.md
|
||||||
|
|||||||
Reference in New Issue
Block a user