summaryrefslogtreecommitdiff
path: root/archaeological_operations/data_importer.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations/data_importer.py')
-rw-r--r--archaeological_operations/data_importer.py53
1 files changed, 47 insertions, 6 deletions
diff --git a/archaeological_operations/data_importer.py b/archaeological_operations/data_importer.py
index de0965ed8..cad929d20 100644
--- a/archaeological_operations/data_importer.py
+++ b/archaeological_operations/data_importer.py
@@ -24,7 +24,8 @@ from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _
from ishtar_common.data_importer import *
-from ishtar_common.models import Town, OrganizationType
+from ishtar_common.models import Town, OrganizationType, SourceType, \
+ SupportType, Format, AuthorType
from archaeological_operations import models
from archaeological_operations.utils import parse_parcels
@@ -147,6 +148,7 @@ RE_CD_POSTAL_FILTER = re.compile("(\d*) (\d*)")
RE_ORGA = re.compile("([^,]*)")
class OperationImporterBibracte(Importer):
+ OBJECT_CLS = models.Operation
DESC = u"Exports Bibracte : importeur pour l'onglet opération"
DEFAULTS = {
('operator',):{
@@ -174,16 +176,11 @@ class OperationImporterBibracte(Importer):
ImportFormater('periods', TypeFormater(models.Period, many_split="&")),
]
- OBJECT_CLS = models.Operation
-
-
RE_PARCEL_SECT_NUM = re.compile("([A-Za-z]*)([0-9]*)")
RE_NUM_INSEE = re.compile("([0-9]*)")
class ParcelImporterBibracte(Importer):
-
OBJECT_CLS = models.Parcel
-
DESC = u"Exports Bibracte : importeur pour l'onglet parcelles"
DEFAULTS = {
('operator',):{
@@ -221,3 +218,47 @@ class ParcelImporterBibracte(Importer):
ImportFormater('address', UnicodeFormater(500),
required=False,),
]
+
+class DocImporterBibracte(Importer):
+ OBJECT_CLS = models.OperationSource
+ DEFAULTS = {
+ ('authors',):{
+ 'author_type':AuthorType.objects.get(
+ txt_idx="main_author")},
+ }
+ DESC = u"Exports Bibracte : importeur pour l'onglet documentation"
+ LINE_FORMAT = [
+ # code OA
+ ImportFormater('operation__operation_code', IntegerFormater(),),
+ # identifiant documentation
+ ImportFormater('external_id', UnicodeFormater(12),),
+ # type
+ ImportFormater('source_type', TypeFormater(SourceType), required=False),
+ # nature support
+ ImportFormater('support_type', TypeFormater(SupportType), required=False),
+ # nombre element
+ ImportFormater('item_number', IntegerFormater(), required=False),
+ # auteur
+ ImportFormater('authors__person__raw_name', UnicodeFormater(300), required=False),
+ # annee
+ ImportFormater('creation_date', DateFormater('%Y'),),
+ # format
+ ImportFormater('format_type', TypeFormater(Format), required=False),
+ # description legende
+ ImportFormater('description', UnicodeFormater(1000), required=False),
+ # type contenant
+ None,
+ # numero contenant
+ None,
+ # commentaire
+ ImportFormater('comment', UnicodeFormater(1000), required=False),
+ # echelle
+ ImportFormater('scale', UnicodeFormater(30), required=False),
+ # type sous contenant
+ None,
+ # numero sous contenant
+ None,
+ # informations complementaires
+ ImportFormater('additional_information', UnicodeFormater(1000),
+ required=False),
+ ]