X-Git-Url: https://git.mdrn.pl/django-migdal.git/blobdiff_plain/6f42e02b4415e5f822739a47a7533cbb96794bcb..336f39228c9206e9ff728b65f14d838076452a13:/migdal/search_indexes.py diff --git a/migdal/search_indexes.py b/migdal/search_indexes.py index d5b57c0..91f7ab7 100644 --- a/migdal/search_indexes.py +++ b/migdal/search_indexes.py @@ -16,13 +16,15 @@ class EntryIndex(indexes.SearchIndex, indexes.Indexable): date = indexes.DateTimeField(indexed=True, model_attr="date") author = indexes.CharField(model_attr="author") + def prepare_date(self, obj): + date = u'' + if 'date' in self.prepared_data: + date = self.prepared_data['date'].strftime('%Y-%m-%dT%H:%M:%SZ') + return date + def get_model(self): return Entry - def index_queryset(self, using=None): - """Used when the entire index for model is updated.""" - return self.get_model().objects.all() - add_translatable_index(EntryIndex, { 'title': indexes.CharField(null=True),