Skip to content

Commit

Permalink
Merge pull request #34 from miki725/plain
Browse files Browse the repository at this point in the history
Plain backend returning list
  • Loading branch information
miki725 committed May 20, 2017
2 parents 8b031cf + 603b786 commit 6e00070
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
History
-------

0.3.2 (2017-05-19)
~~~~~~~~~~~~~~~~~~

* Fixed plain backend to return list in Python 3 vs ``filter()`` generator
which is not compatible with Django pagination since it requires ``len()``
to be implemented.

0.3.1 (2017-05-18)
~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion tests/backends/test_plain.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def _test_filter(self, spec, expected):
backend = PlainFilterBackend(DATA)
backend.bind([spec])

assert list(backend.filter()) == expected
assert backend.filter() == expected

def test_filter_contains(self):
self._test_filter(
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__ = 'miroslav@miki725.com'
__version__ = '0.3.1'
__version__ = '0.3.2'
2 changes: 1 addition & 1 deletion url_filter/backends/plain.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def filter_by_specs(self, queryset):
if not self.regular_specs:
return queryset

return filter(self._filter_callable, queryset)
return list(filter(self._filter_callable, queryset))

def _filter_callable(self, item):
return all(self._filter_by_spec(item, spec) for spec in self.regular_specs)
Expand Down

0 comments on commit 6e00070

Please sign in to comment.