summaryrefslogtreecommitdiff
path: root/archaeological_operations/data_importer.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2015-01-26 21:41:59 +0100
committerÉtienne Loks <etienne.loks@proxience.com>2015-01-26 21:41:59 +0100
commit97a7791ace5e6706f88d163c23a1f2ad6746eb9c (patch)
tree927690a6a830ff0fa04d24c3242fc564502e55a0 /archaeological_operations/data_importer.py
parent326f81f1a61cc91587aa92fd6793045d2f2c139c (diff)
downloadIshtar-97a7791ace5e6706f88d163c23a1f2ad6746eb9c.tar.bz2
Ishtar-97a7791ace5e6706f88d163c23a1f2ad6746eb9c.zip
Improve/fix import management. Bibracte import for operations.
Diffstat (limited to 'archaeological_operations/data_importer.py')
-rw-r--r--archaeological_operations/data_importer.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/archaeological_operations/data_importer.py b/archaeological_operations/data_importer.py
index e02b53df0..ebcc039d0 100644
--- a/archaeological_operations/data_importer.py
+++ b/archaeological_operations/data_importer.py
@@ -24,9 +24,9 @@ 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
+from ishtar_common.models import Town, OrganizationType
-from archaeological_operations.models import Parcel
+from archaeological_operations import models
from archaeological_operations.utils import parse_parcels
RE_PERMIT_REFERENCE = re.compile('[A-Za-z]*(.*)')
@@ -45,7 +45,7 @@ class ImportParcelFormater(ImportFormater):
for parcel_dct in parse_parcels(value, owner=owner):
parcel_dct.update(base_dct)
try:
- Parcel.objects.get_or_create(**parcel_dct)
+ models.Parcel.objects.get_or_create(**parcel_dct)
except IntegrityError:
raise ImporterError("Erreur d'import parcelle, contexte : %s" \
% unicode(parcel_dct))
@@ -148,8 +148,9 @@ RE_ORGA = re.compile("([^,]*)")
class OperationImporterBibracte(Importer):
+ DESC = u"Exports Bibracte : importeur pour l'onglet opération"
DEFAULTS = {
- ('in_charge',):{
+ ('operator',):{
'organization_type':OrganizationType.objects.get(
txt_idx="operator")},
}
@@ -171,10 +172,8 @@ class OperationImporterBibracte(Importer):
# fin
ImportFormater('excavation_end_date', DateFormater('%Y/%m/%d'),),
# Chronos
- ImportFormater('periods', TypeFormater(models.Period, many=True),
- many=True),
+ ImportFormater('periods', TypeFormater(models.Period, many_split="&")),
]
OBJECT_CLS = models.Operation
- DEFAULTS = {}