Python haystack.query.EmptySearchQuerySet() Examples
The following are 3
code examples of haystack.query.EmptySearchQuerySet().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
haystack.query
, or try the search function
.
Example #1
Source File: forms.py From Spirit with MIT License | 6 votes |
def search(self): sqs = super(AdvancedSearchForm, self).search() if isinstance(sqs, EmptySearchQuerySet): return sqs topics = sqs.models(Topic) categories = self.cleaned_data['category'] if categories: topics = topics.filter( category_id__in=[c.pk for c in categories]) # See: haystack pull #1141 and #1093 # querying False won't work on elastic return topics.filter(is_removed=0)
Example #2
Source File: forms.py From Spirit with MIT License | 5 votes |
def search(self): sqs = super(BasicSearchForm, self).search() if isinstance(sqs, EmptySearchQuerySet): return sqs topics = sqs.models(Topic) # See: haystack pull #1141 and #1093 # querying False won't work on elastic return topics.filter(is_removed=0)
Example #3
Source File: serializers.py From drf-haystack with MIT License | 5 votes |
def __init__(self, instance=None, data=empty, **kwargs): super(HaystackSerializer, self).__init__(instance, data, **kwargs) if not self.Meta.index_classes and not self.Meta.serializers: raise ImproperlyConfigured("You must set either the 'index_classes' or 'serializers' " "attribute on the serializer Meta class.") if not self.instance: self.instance = EmptySearchQuerySet()