From 72b0336b75d6adce6edce85102932363ebf9a0b7 Mon Sep 17 00:00:00 2001 From: collerek Date: Thu, 26 Nov 2020 12:22:12 +0100 Subject: [PATCH] update docs with tip on order_by --- docs/queries.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/queries.md b/docs/queries.md index 9b1f5fa..c848bc1 100644 --- a/docs/queries.md +++ b/docs/queries.md @@ -267,8 +267,11 @@ 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() @@ -311,8 +314,11 @@ 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()