X-Git-Url: https://git.mdrn.pl/prawokultury.git/blobdiff_plain/b1fb752ca1abb051a63da4729e34a80affc25c76..ce7f059d284616e5bf6f62306c1def5d9aae5ab4:/migdal/search_indexes.py diff --git a/migdal/search_indexes.py b/migdal/search_indexes.py index 6223b6e..333899f 100644 --- a/migdal/search_indexes.py +++ b/migdal/search_indexes.py @@ -1,13 +1,14 @@ +from django.conf import settings import datetime from haystack import indexes from migdal.models import Entry -from django.conf import settings + from copy import copy class EntryIndex(indexes.SearchIndex, indexes.Indexable): - date = indexes.DateTimeField(indexed=True) - author = indexes.CharField() + date = indexes.DateTimeField(indexed=True, model_attr="date") + author = indexes.CharField(model_attr="author") def get_model(self): return Entry @@ -26,6 +27,7 @@ def add_translatable(index_class, fields, languages=None): new_field = copy(field) fname = "%s_%s" % (name, lang_code) new_field.index_fieldname = fname + new_field.model_attr = fname setattr(index_class, fname, new_field) index_class.fields[fname] = new_field