update docs with tip on order_by

This commit is contained in:
collerek
2020-11-26 12:22:12 +01:00
parent 78d1241807
commit 72b0336b75

View File

@ -267,9 +267,12 @@ To chain related `Models` relation use double underscores between names.
only singe relation types, while in `ormar` you can select related across `ForeignKey` relation,
reverse side of `ForeignKey` (so virtual auto generated keys) and `ManyToMany` fields (so all relations as of current version).
!!!note
!!!tip
To control which model fields to select use `fields()` and `exclude_fields()` `QuerySet` methods.
!!!tip
To control order of models (both main or nested) use `order_by()` method.
```python
album = await Album.objects.select_related("tracks").all()
# will return album will all columns tracks
@ -311,9 +314,12 @@ To fetch related model use `ForeignKey` names.
To chain related `Models` relation use double underscores between names.
!!!note
!!!tip
To control which model fields to select use `fields()` and `exclude_fields()` `QuerySet` methods.
!!!tip
To control order of models (both main or nested) use `order_by()` method.
```python
album = await Album.objects.prefetch_related("tracks").all()
# will return album will all columns tracks