Skip to content

Commit

Permalink
prepare 0.17.7
Browse files Browse the repository at this point in the history
  • Loading branch information
barseghyanartur committed May 29, 2019
1 parent febce15 commit 518733b
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 11 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ are used for versioning (schema follows below):

0.17.7
------
2019-xx-xx (not-yet-released)
2019-05-30

.. note::

Expand All @@ -29,6 +29,7 @@ are used for versioning (schema follows below):
- Fixes in occasionally failing search test (``test_search`` and
``test_filtering_geo_spatial``).
- Working travis.
- Fixed issue with errors on empty ``ids`` filter.

0.17.6
------
Expand Down
3 changes: 2 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ are used for versioning (schema follows below):

0.17.7
------
2019-xx-xx (not-yet-released)
2019-05-30

.. note::

Expand All @@ -29,6 +29,7 @@ are used for versioning (schema follows below):
- Fixes in occasionally failing search test (``test_search`` and
``test_filtering_geo_spatial``).
- Working travis.
- Fixed issue with errors on empty ``ids`` filter.

0.17.6
------
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from setuptools import find_packages, setup

version = '0.17.6'
version = '0.17.7'

DOCS_TRANSFORMATIONS = (
(
Expand Down Expand Up @@ -200,7 +200,7 @@
url='https://github.com/barseghyanartur/django-elasticsearch-dsl-drf/',
package_dir={'': 'src'},
packages=find_packages(where='./src'),
license='GPL 2.0/LGPL 2.1',
license='GPL-2.0-only OR LGPL-2.1-or-later',
install_requires=(install_requires + extras_require),
tests_require=tests_require,
include_package_data=True,
Expand Down
2 changes: 1 addition & 1 deletion src/django_elasticsearch_dsl_drf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

__title__ = 'django-elasticsearch-dsl-drf'
__version__ = '0.17.6'
__version__ = '0.17.7'
__author__ = 'Artur Barseghyan <[email protected]>'
__copyright__ = '2017-2019 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ def get_ids_values(self, request, view):
:rtype: elasticsearch_dsl.search.Search
"""
query_params = self.get_ids_query_params(request)
__ids = []
for __id in query_params:
__values = self.split_lookup_complex_value(__id)
__ids += __values
return __ids
_ids = []
for _id in query_params:
_values = self.split_lookup_complex_value(_id)
_ids += _values
return _ids

def filter_queryset(self, request, queryset, view):
"""Filter the queryset.
Expand All @@ -109,8 +109,10 @@ def filter_queryset(self, request, queryset, view):
__ids = self.get_ids_values(request, view)

if __ids:
_ids = [_i for _i in __ids if _i]
queryset = queryset.query(
'ids',
**{'values': __ids, 'type': view.mapping}
**{'values': _ids, 'type': view.mapping}
)

return queryset
14 changes: 14 additions & 0 deletions src/django_elasticsearch_dsl_drf/tests/test_filtering_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,20 @@ def test_ids_filter(self):
self.published_count
)

def test_ids_empty_filter(self):
"""Test ids filter with empty value. This should not fail.
Example:
http://localhost:8000/api/articles/?ids=
"""
__ids = []
return self._field_filter_value(
'ids',
SEPARATOR_LOOKUP_COMPLEX_VALUE.join(__ids),
0
)

def test_default_filter_lookup(self):
"""Test default filter lookup.
Expand Down

0 comments on commit 518733b

Please sign in to comment.