From 43d89af9d96fc98191247e7d565c8504d6c411cd Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 11 Jun 2015 02:20:23 +0200 Subject: Work on find importer --- ishtar_common/models.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'ishtar_common/models.py') diff --git a/ishtar_common/models.py b/ishtar_common/models.py index b3bead9ab..2729aeeef 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -59,7 +59,7 @@ from ishtar_common.model_merging import merge_model_objects from ishtar_common.utils import get_cache from ishtar_common.data_importer import Importer, ImportFormater, \ IntegerFormater, FloatFormater, UnicodeFormater, DateFormater, \ - TypeFormater, YearFormater + TypeFormater, YearFormater, StrToBoolean def post_save_user(sender, **kwargs): user = kwargs['instance'] @@ -979,6 +979,10 @@ if 'archaeological_context_records' in settings.INSTALLED_APPS: MODELS = [('archaeological_context_records.models.ContextRecord', _(u"Context records")), ] + MODELS +if 'archaeological_finds' in settings.INSTALLED_APPS: + MODELS = [('archaeological_finds.models.BaseFind', + _(u"Finds")), + ] + MODELS def get_model_fields(model): """ @@ -1259,6 +1263,7 @@ IMPORTER_TYPES = ( ('DateFormater', _(u"Date")), ('TypeFormater', _(u"Type")), ('YearFormater', _(u"Year")), + ('StrToBoolean', _(u"String to boolean")), ) IMPORTER_TYPES_DCT = { @@ -1268,6 +1273,7 @@ IMPORTER_TYPES_DCT = { 'DateFormater':DateFormater, 'TypeFormater':TypeFormater, 'YearFormater':YearFormater, + 'StrToBoolean':StrToBoolean, } DATE_FORMATS = ( @@ -1324,6 +1330,8 @@ class FormaterType(models.Model): return elif self.formater_type == 'DateFormater': return DateFormater(self.options, **kwargs) + elif self.formater_type == 'StrToBoolean': + return StrToBoolean(**kwargs) else: return IMPORTER_TYPES_DCT[self.formater_type](**kwargs) -- cgit v1.2.3