diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2014-12-21 19:57:35 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2014-12-21 19:57:35 +0100 |
commit | 1a27e3fda70bcd1cb0509c3d36e79553c4bc7cbe (patch) | |
tree | 203fe5cb46c9f9ecede84ed7bbe6080f9a1e1f7f /ishtar_common/models.py | |
parent | b1601241fd127462706a7fde0022071f29f233ef (diff) | |
download | Ishtar-1a27e3fda70bcd1cb0509c3d36e79553c4bc7cbe.tar.bz2 Ishtar-1a27e3fda70bcd1cb0509c3d36e79553c4bc7cbe.zip |
Add a new table to manage imports
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index be35c4350..2845b7c1c 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -894,6 +894,47 @@ class OrganizationType(GeneralType): verbose_name_plural = _(u"Organization types") ordering = ('label',) +IMPORT_STATE = (("C", _(u"Created")), + ("AP", _(u"Analyse in progress")), + ("A", _(u"Analysed")), + ("P", _(u"Import pending")), + ("IP", _(u"Import in progress")), + ("F", _(u"Finished"))) + +IMPORT_TYPE = ( + ('archaeological_files.data_importer.FileImporterSraPdL', + _("Archaeological files - SRA Pays de la Loire")), + ('custom', _(u"Custom")) + ) + +class Import(models.Model): + name = models.CharField(_(u"Name"), blank=True, null=True, + max_length=100) + user = models.ForeignKey('IshtarUser') + imported_file = models.FileField(_(u"Imported file"), + upload_to="upload/imports/") + error_file = models.FileField(_(u"Error file"), + upload_to="upload/imports/", + blank=True, null=True) + result_file = models.FileField(_(u"Result file"), + upload_to="upload/imports/", + blank=True, null=True) + importer_type = models.CharField(_(u"Importer type"), max_length=200, + choices=IMPORT_TYPE) + state = models.CharField(_(u"State"), max_length=2, choices=IMPORT_STATE) + creation_date = models.DateTimeField(_(u"Creation date"), blank=True, + null=True) + end_date = models.DateTimeField(_(u"End date"), blank=True, + null=True) + seconds_remaining = models.IntegerField(_(u"Seconds remaining"), blank=True, + null=True) + class Meta: + verbose_name = _(u"Import") + verbose_name_plural = _(u"Imports") + + def __unicode__(self): + return self.name + class Organization(Address, Merge, OwnPerms, ValueGetter): TABLE_COLS = ('name', 'organization_type',) name = models.CharField(_(u"Name"), max_length=300) |