mirror of
https://github.com/Hopiu/django-watson.git
synced 2026-03-16 22:00:22 +00:00
Fix #188: Get rid of the workaround for django's __in bug
Related bug: https://code.djangoproject.com/ticket/15145
This commit is contained in:
parent
f3c6de2809
commit
ba2f9d1341
1 changed files with 3 additions and 14 deletions
|
|
@ -537,20 +537,9 @@ class SearchEngine(object):
|
|||
object_id_int__in=queryset,
|
||||
)
|
||||
else:
|
||||
live_ids = list(queryset)
|
||||
if live_ids:
|
||||
filter &= Q(
|
||||
object_id__in=live_ids,
|
||||
)
|
||||
else:
|
||||
# HACK: There is a bug in Django
|
||||
# (https://code.djangoproject.com/ticket/15145)
|
||||
# that messes up __in queries when the iterable is empty.
|
||||
# This bit of nonsense ensures that this aspect of the query
|
||||
# will be impossible to fulfill.
|
||||
filter &= Q(
|
||||
content_type=ContentType.objects.get_for_model(model).id + 1,
|
||||
)
|
||||
filter &= Q(
|
||||
object_id__in=queryset,
|
||||
)
|
||||
# Add the model to the filter.
|
||||
content_type = ContentType.objects.get_for_model(model)
|
||||
filter &= Q(
|
||||
|
|
|
|||
Loading…
Reference in a new issue