summaryrefslogtreecommitdiff
path: root/ishtar_common/models_imports.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2023-08-07 12:46:54 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2024-02-05 10:51:51 +0100
commitebe1e07e968209d4396a6bc90ccdc9b550870645 (patch)
tree551da2a7c8db899e31b04df2484bb20893b4d860 /ishtar_common/models_imports.py
parentd08cd8689ce93e3f046bf14b1cd954b476660aba (diff)
downloadIshtar-ebe1e07e968209d4396a6bc90ccdc9b550870645.tar.bz2
Ishtar-ebe1e07e968209d4396a6bc90ccdc9b550870645.zip
✨ Imports - model: link import -> import group
Diffstat (limited to 'ishtar_common/models_imports.py')
-rw-r--r--ishtar_common/models_imports.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/ishtar_common/models_imports.py b/ishtar_common/models_imports.py
index e9a7cf6df..76148a1a6 100644
--- a/ishtar_common/models_imports.py
+++ b/ishtar_common/models_imports.py
@@ -1311,6 +1311,31 @@ class ImportGroup(BaseImport):
return ""
return IMPORT_GROUP_STATE_DCT[self.state]
+ def get_actions(self):
+ """
+ Get available action relevant with the current status
+ """
+ actions = []
+ if self.state == "C":
+ actions.append(("A", _("Analyse")))
+ if self.state == "A":
+ actions.append(("A", _("Re-analyse")))
+ actions.append(("I", _("Launch import")))
+ if self.state in ("F", "FE"):
+ actions.append(("A", _("Re-analyse")))
+ actions.append(("I", _("Re-import")))
+ actions.append(("AC", _("Archive")))
+ if self.state == "AC":
+ state = "FE" if self.error_file else "F"
+ actions.append((state, _("Unarchive")))
+ if self.state in ("C", "A"):
+ actions.append(("ED", _("Edit")))
+ actions.append(("D", _("Delete")))
+ return actions
+
+ def save(self, *args, **kwargs):
+ super().save(*args, **kwargs)
+
class Import(BaseImport):
importer_type = models.ForeignKey(ImporterType, on_delete=models.CASCADE,
@@ -1383,6 +1408,8 @@ class Import(BaseImport):
null=True,
validators=[validate_comma_separated_integer_list],
)
+ group = models.ForeignKey(ImportGroup, blank=True, null=True, on_delete=models.CASCADE,
+ verbose_name=_("Group"), related_name="imports")
class Meta:
verbose_name = _("Import - Import")