X-Git-Url: https://git.mdrn.pl/prawokultury.git/blobdiff_plain/9c8f0adb8bb6c8b86517798d70c2c8dcd198e721..fb2d5b78a90d3042f7eb5e8e419fcbe6e62fd00d:/migdal/search_indexes.py?ds=sidebyside 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