From a27ee0d568b036a71d7e5c9389c701c8480acd11 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Fri, 16 Mar 2018 15:21:08 +0100 Subject: [PATCH] prepare date for solr --- migdal/search_indexes.py | 6 ++++++ setup.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/migdal/search_indexes.py b/migdal/search_indexes.py index fc35cff..91f7ab7 100644 --- a/migdal/search_indexes.py +++ b/migdal/search_indexes.py @@ -16,6 +16,12 @@ 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 diff --git a/setup.py b/setup.py index 69acd90..a6136b2 100755 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ def whole_trees(package_dir, paths): setup( name='django-migdal', - version='0.7.4', + version='0.7.5', author='Radek Czajka', author_email='radoslaw.czajka@nowoczesnapolska.org.pl', maintainer='Jan Szejko', -- 2.20.1