Skip to content

Commit

Permalink
doc: fix sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
e-kondr01 committed Oct 4, 2024
1 parent ef0c5d9 commit 6a9f92c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/ru/sorting.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

- Определить поля, по которым доступна фильтрация.

Это может быть либо списком/кортежем полей основной модели:
Это может быть:

1. Cпискок или кортеж полей основной модели:

```python
from app.models import Child
Expand All @@ -25,16 +27,15 @@ child_ordering_fields = (

Дефис первым символом означает направление сортировки по убыванию.

Либо можно определить маппинг строковых полей для сортировки
на соответствующие поля моделей:
2. Маппинг строковых полей для сортировки на соответствующие поля моделей:

```python
from app.models import Child, Parent

child_ordering_fields = (
child_ordering_fields = {
"title": MyModel.title,
"parent_title": ParentModel.title
)
}
```

В таком случае, будут доступны следующий параметря для сортировки:
Expand Down

0 comments on commit 6a9f92c

Please sign in to comment.