summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 1621f05db..51cf1096f 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -1095,9 +1095,14 @@ MODELS = [
_(u"Operation source")),
]
+IMPORTER_CLASSES = []
+
if 'archaeological_files' in settings.INSTALLED_APPS:
MODELS = [('archaeological_files.models.File', _(u"Archaeological files"))]\
+ MODELS
+ IMPORTER_CLASSES = [
+ 'archaeological_files.data_importer.FileImporterSraPdL'] + \
+ IMPORTER_CLASSES
if 'archaeological_context_records' in settings.INSTALLED_APPS:
MODELS = [('archaeological_context_records.models.ContextRecord',
_(u"Context records")), ] + MODELS
@@ -1134,6 +1139,8 @@ class ImporterType(models.Model):
"""
name = models.CharField(_(u"Name"), blank=True, null=True,
max_length=100)
+ slug = models.SlugField(_(u"Slug"), unique=True, blank=True, null=True,
+ max_length=100)
description = models.CharField(_(u"Description"), blank=True, null=True,
max_length=500)
users = models.ManyToManyField('IshtarUser', verbose_name=_(u"Users"),
@@ -1150,6 +1157,9 @@ class ImporterType(models.Model):
return self.name
def get_importer_class(self):
+ if self.slug and self.slug in IMPORTER_CLASSES:
+ cls = import_class(IMPORTER_CLASSES[self.slug])
+ return cls
OBJECT_CLS = import_class(self.associated_models)
DEFAULTS = dict([(default.keys, default.values)
for default in self.defaults.all()])
@@ -1457,7 +1467,8 @@ IMPORTER_TYPES_DCT = {
'TypeFormater': TypeFormater,
'YearFormater': YearFormater,
'StrToBoolean': StrToBoolean,
- 'FileFormater': FileFormater
+ 'FileFormater': FileFormater,
+ 'UnknowType': None,
}
DATE_FORMATS = (