mirror of
https://github.com/HackSoftware/Django-Styleguide.git
synced 2025-04-28 12:13:48 +03:00
Fix name of selectors
This commit is contained in:
parent
7886bfa432
commit
ad51865d25
|
@ -452,15 +452,15 @@ A selector follows the same rules as a service.
|
||||||
For example, in a module `<your_app>/selectors.py`, we can have the following:
|
For example, in a module `<your_app>/selectors.py`, we can have the following:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def users_list(*, fetched_by: User) -> Iterable[User]:
|
def user_list(*, fetched_by: User) -> Iterable[User]:
|
||||||
user_ids = users_get_visible_for(user=fetched_by)
|
user_ids = user_get_visible_for(user=fetched_by)
|
||||||
|
|
||||||
query = Q(id__in=user_ids)
|
query = Q(id__in=user_ids)
|
||||||
|
|
||||||
return User.objects.filter(query)
|
return User.objects.filter(query)
|
||||||
```
|
```
|
||||||
|
|
||||||
As you can see, `users_get_visible_for` is another selector.
|
As you can see, `user_get_visible_for` is another selector.
|
||||||
|
|
||||||
You can return querysets, or lists or whatever makes sense to your specific case.
|
You can return querysets, or lists or whatever makes sense to your specific case.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user