Skip to content

Commit 9e66c16

Browse files
committed
Made retrieve_search_results() always return a queryset, which lets us use .exists() on the returned value as needed.
- Legacy-Id: 12007
1 parent f8bca9b commit 9e66c16

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

ietf/doc/views_search.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@
3838
from django.core.cache import cache
3939
from django.core.urlresolvers import reverse as urlreverse
4040
from django.db.models import Q
41+
from django.db.models.query import EmptyQuerySet
4142
from django.http import Http404, HttpResponseBadRequest, HttpResponse, HttpResponseRedirect, QueryDict
4243
from django.shortcuts import render
4344
from django.utils.cache import _generate_cache_key
4445

46+
4547
import debug # pyflakes:ignore
4648

4749
from ietf.doc.models import ( Document, DocHistory, DocAlias, State,
@@ -142,7 +144,7 @@ def retrieve_search_results(form, all_types=False):
142144
types.extend(query["doctypes"])
143145

144146
if not types:
145-
return []
147+
return EmptyQuerySet()
146148

147149
docs = Document.objects.filter(type__in=types)
148150

0 commit comments

Comments
 (0)