update docs with tip on order_by
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user