diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2015-01-26 13:57:43 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-01-26 13:57:43 +0100 |
commit | 326f81f1a61cc91587aa92fd6793045d2f2c139c (patch) | |
tree | 88d1959cc1d096bd6d318623850b24310865eab8 /archaeological_operations | |
parent | 026274e37f85b12133627f576aad3d2a242144af (diff) | |
download | Ishtar-326f81f1a61cc91587aa92fd6793045d2f2c139c.tar.bz2 Ishtar-326f81f1a61cc91587aa92fd6793045d2f2c139c.zip |
Importer: manage many values in one field
Diffstat (limited to 'archaeological_operations')
-rw-r--r-- | archaeological_operations/data_importer.py | 19 | ||||
-rw-r--r-- | archaeological_operations/models.py | 4 |
2 files changed, 16 insertions, 7 deletions
diff --git a/archaeological_operations/data_importer.py b/archaeological_operations/data_importer.py index 4402c8b17..e02b53df0 100644 --- a/archaeological_operations/data_importer.py +++ b/archaeological_operations/data_importer.py @@ -148,22 +148,31 @@ RE_ORGA = re.compile("([^,]*)") class OperationImporterBibracte(Importer): + DEFAULTS = { + ('in_charge',):{ + 'organization_type':OrganizationType.objects.get( + txt_idx="operator")}, + } LINE_FORMAT = [ # CODE OPE - ImportFormater('operation_code', - IntegerFormater(),), + ImportFormater('operation_code', IntegerFormater(),), # REGION None, # TYPE operation - ImportFormater('operation_type', - TypeFormater(models.OperationType),), - + ImportFormater('operation_type', TypeFormater(models.OperationType),), # NOM + ImportFormater('common_name', UnicodeFormater(120),), # OPERATEUR + ImportFormater('operator__name', UnicodeFormater(120),), # resp. lien IMPORT avec personne + ImportFormater('in_charge__raw_name', UnicodeFormater(300),), # début + ImportFormater('start_date', DateFormater('%Y/%m/%d'),), # fin + ImportFormater('excavation_end_date', DateFormater('%Y/%m/%d'),), # Chronos + ImportFormater('periods', TypeFormater(models.Period, many=True), + many=True), ] OBJECT_CLS = models.Operation diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 00c2dd523..21ae4e15a 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -157,12 +157,12 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem, 'start_date', 'excavation_end_date'] if FILES_AVAILABLE: TABLE_COLS.insert(4, 'associated_file_short_label') - start_date = models.DateField(_(u"Start date"), null=True, blank=True) creation_date = models.DateField(_(u"Creation date"), default=datetime.date.today) + end_date = models.DateField(_(u"Closing date"), null=True, blank=True) + start_date = models.DateField(_(u"Start date"), null=True, blank=True) excavation_end_date = models.DateField(_(u"Excavation end date"), null=True, blank=True) - end_date = models.DateField(_(u"Closing date"), null=True, blank=True) report_delivery_date = models.DateField(_(u"Report delivery date"), null=True, blank=True) scientist = models.ForeignKey(Person, blank=True, null=True, |