Sorting
ballsdex.core.utils.sorting
filter_balls
filter_balls(filter: FilteringChoices, queryset: QuerySet[BallInstance], guild_id: int | None = None) -> QuerySet[BallInstance]
Edit a list of ball instances in place to apply the selected filtering options.
Parameters:
-
filter
(FilteringChoices
) –One of the supported filtering methods
-
queryset
(QuerySet[BallInstance]
) –A ballinstance queryset.
-
guild_id
(int | None
, default:None
) –The ID of the server to filter by. Only used for the
this_server
filter. If not provided, this filter will be ignored.
Returns:
-
QuerySet[BallInstance]
–The modified query applying the filtering.
Source code in ballsdex/core/utils/sorting.py
sort_balls
sort_balls(sort: SortingChoices, queryset: QS) -> QS
Edit a queryset in place to apply the selected sorting options. You can call this function multiple times with the same queryset to have multiple sort methods.
Parameters:
-
sort
(SortingChoices
) –One of the supported sorting methods
-
queryset
(QS
) –An existing queryset of ball instances. This can be obtained with, for example,
BallInstance.all()
orBallInstance.filter(player=x)
without awaiting the result!
Returns:
-
QuerySet[BallInstance]
–The same queryset modified to apply the ordering. Await it to obtain the result.