Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_search_results throws an exception when called with a QuerySetSequence (not a QuerySet as usually) #1190

Closed
stoffi92 opened this issue Oct 19, 2020 · 1 comment

Comments

@stoffi92
Copy link

v3.7.x introduces a get_search_result function in [src/dal/views.py] BaseQuerySetView which (at least in my case) throws an exception when called with a QuerySetSequence (instead of a Queryset):

Traceback (most recent call last):
  File "venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 179, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "venv/lib/python3.7/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "venv/lib/python3.7/site-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "venv/lib/python3.7/site-packages/dal/views.py", line 55, in dispatch
    return super(ViewMixin, self).dispatch(request, *args, **kwargs)
  File "venv/lib/python3.7/site-packages/django/views/generic/base.py", line 98, in dispatch
    return handler(request, *args, **kwargs)
  File "venv/lib/python3.7/site-packages/django/views/generic/list.py", line 142, in get
    self.object_list = self.get_queryset()
  File "venv/lib/python3.7/site-packages/dal_queryset_sequence/views.py", line 47, in get_queryset
    qs = super(BaseQuerySetSequenceView, self).get_queryset()
  File "venv/lib/python3.7/site-packages/dal/views.py", line 106, in get_queryset
    qs = self.get_search_results(qs, self.q)
  File "venv/lib/python3.7/site-packages/dal/views.py", line 146, in get_search_results
    queryset = queryset.filter(reduce(operator.or_, or_queries))
TypeError: filter() takes 1 positional argument but 2 were given

@jpic
Copy link
Member

jpic commented Nov 18, 2020

Thank you for reporting, a fix targets next minor release #1199

jpic added a commit that referenced this issue May 3, 2021
jpic added a commit that referenced this issue May 3, 2021
jpic added a commit that referenced this issue Nov 23, 2021
jpic added a commit that referenced this issue Nov 23, 2021
@jpic jpic closed this as completed in bd63086 Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants