Drf-url-filters

Latest version: v0.5.1

Safety actively analyzes 681775 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 2

0.5.1

usage of metaclass using six to keep it compatible with python 2 and 3

0.5.0

Add support for Multi-valued (delimiter separated) validators.

0.4.0

- Add support for value transformations.
- Remove the need for overriding `get_queryset()` for drf-url-filters to work.
- Validation code refactor.

0.3.0

drf-url-filters now supports python3

0.2.0

Support for excluding querysets based upon `.exclude()` method of queryset by adding a mapping key with a prefix `~` i.e `~update_ts__gte` and passing the same query param in url will exclude the results for given condition.

python
def get_queryset(self):
"""
Optionally restricts the queryset by filtering against
query parameters in the URL.
"""
query_params = self.request.query_params
url_params = self.kwargs

get queryset_filters from FilterMixin
queryset_filters = self.get_db_filters(url_params, query_params)

This dict will hold filter kwargs to pass in to Django ORM calls.
db_filters = queryset_filters['db_filters']

This dict will hold exclude kwargs to pass in to Django ORM calls.
db_excludes = queryset_filters['db_excludes']

fetch queryset from Players model
queryset = Player.objects.prefetch_related(
'teams' use prefetch_related to minimize db hits.
).all()

return queryset.filter(**db_filters).exclude(**db_excludes)

0.1.4

Fixed the return value for CSVofIntegers to be (uniform) list of integers.

i.e
5 => [5]
'3,4,5,6' => [3, 4, 5, 6]
'4' = > [4]

Page 1 of 2

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.