Skip to content

Commit

Permalink
bumping version for __all__ support
Browse files Browse the repository at this point in the history
  • Loading branch information
miki725 committed Jan 24, 2019
1 parent f8867f6 commit 76123e3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
History
-------

0.3.12 (2019-01-24)
~~~~~~~~~~~~~~~~~~~

* Adding support for ``FilterSet.Meta.fields == '__all__'` which is useful in DRF integration.
See `#39 <https://github.com/miki725/django-url-filter/pull/39>`_.
0.3.11 (2018-12-06)
~~~~~~~~~~~~~~~~~~~
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ importanize:

lint: ## check style with flake8
flake8 .
python --version | grep "Python 3" && make importanize || true
if python -c "import sys; exit(1) if sys.version[:3] < '3.6' else exit(0)"; \
then \
make importanize ; \
fi

test: ## run tests quickly with the default Python
py.test -sv --cov=url_filter --cov-report=term-missing --doctest-modules tests/ url_filter/
Expand Down
12 changes: 12 additions & 0 deletions tests/integrations/test_drf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ class View(object):
assert filter_class.Meta.model is Place
assert filter_class.Meta.fields == ['name']

def test_get_filter_class_all_fields(self):
class View(object):
filter_fields = '__all__'

filter_class = DjangoFilterBackend().get_filter_class(
View(), Place.objects.all()
)

assert issubclass(filter_class, ModelFilterSet)
assert filter_class.Meta.model is Place
assert set(filter_class().filters.keys()) == {'restaurant', 'id', 'name', 'address'}

def test_get_filter_context(self):
context = DjangoFilterBackend().get_filter_context(
request='request', view='view',
Expand Down
2 changes: 1 addition & 1 deletion url_filter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

__author__ = 'Miroslav Shubernetskiy'
__email__ = '[email protected]'
__version__ = '0.3.11'
__version__ = '0.3.12'

0 comments on commit 76123e3

Please sign in to comment.