diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2015-01-27 15:26:09 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-01-27 15:26:09 +0100 |
commit | c730975bd9dab4deaf79880075fb919ed9f96427 (patch) | |
tree | 70d2aa4499630be5305124b5f3f940c9b9c7b45f /archaeological_context_records | |
parent | f960a671e29949be75d50d1ec9e92e90cd62a9f7 (diff) | |
download | Ishtar-c730975bd9dab4deaf79880075fb919ed9f96427.tar.bz2 Ishtar-c730975bd9dab4deaf79880075fb919ed9f96427.zip |
Bibracte import for context records.
Diffstat (limited to 'archaeological_context_records')
-rw-r--r-- | archaeological_context_records/data_importer.py | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/archaeological_context_records/data_importer.py b/archaeological_context_records/data_importer.py new file mode 100644 index 000000000..166b54359 --- /dev/null +++ b/archaeological_context_records/data_importer.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2015 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# See the file COPYING for details. + +import re + +from django.utils.translation import ugettext_lazy as _ + +from ishtar_common.data_importer import * + +from archaeological_context_records import models + +class ContextRecordsImporterBibracte(Importer): + DESC = u"Exports Bibracte : importeur pour l'onglet UE" + OBJECT_CLS = models.ContextRecord + DEFAULTS = { + } + LINE_FORMAT = [ + # ID operation + ImportFormater('operation__operation_code', IntegerFormater(), + duplicate_field='parcel__operation__operation_code',), + # ID UE + ImportFormater('external_id', UnicodeFormater(120),), + # Type + ImportFormater('unit', TypeFormater(models.Unit), required=False), + # description + ImportFormater('description', UnicodeFormater(1000), required=False,), + # interprétation + ImportFormater('interpretation', UnicodeFormater(1000), required=False,), + # date ouverture + ImportFormater('opening_date', DateFormater('%Y/%m/%d'), required=False,), + # date fermeture + ImportFormater('closing_date', DateFormater('%Y/%m/%d'), required=False,), + # lien vers parcelle + ImportFormater('parcel__external_id', UnicodeFormater(12), + required=False,), + # lien vers ID sig + None, + # commentaire + ImportFormater('comment', UnicodeFormater(1000), required=False,), + # ???? + None, + # chrono + ImportFormater('dating__period', TypeFormater(models.Period, + many_split="&"), required=False), + ] + +class ContextRecordsRelationImporterBibracte(Importer): + DESC = u"Exports Bibracte : importeur pour l'onglet relations entre UE" + OBJECT_CLS = models.RecordRelations + DEFAULTS = {} + LINE_FORMAT = [ + # code OA + ImportFormater('left_record__operation__operation_code', + IntegerFormater(), + duplicate_field='right_record__operation__operation_code',), + # identifiant UE 1 + ImportFormater('left_record__external_id', UnicodeFormater(120),), + # type relation + ImportFormater('relation_type', TypeFormater(models.RelationType),), + # identifiant UE 2 + ImportFormater('right_record__external_id', UnicodeFormater(120),), + ] + |