You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
590 B
20 lines
590 B
from haystack import indexes
|
|
from models import Conference
|
|
|
|
|
|
class PlaceExpositionIndex(indexes.SearchIndex, indexes.Indexable):
|
|
text = indexes.CharField(document=True, use_template=True)
|
|
where = indexes.MultiValueField()
|
|
def prepare_where(self, obj):
|
|
country = [tr.name for tr in obj.country.translations.all()]
|
|
city = [tr.name for tr in obj.city.translations.all()]
|
|
|
|
return country + city
|
|
|
|
def get_model(self):
|
|
return Conference
|
|
|
|
def index_queryset(self, using=None):
|
|
|
|
return self.get_model().objects.filter(is_published=True)
|
|
|
|
|