summaryrefslogtreecommitdiff
path: root/ishtar_common/models_imports.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-08-29 16:56:27 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-08-29 16:56:27 +0200
commit2d810b66963245d12ac9e7d754a1f9e134f5a507 (patch)
treee5f20a49e83b7a4c8d1bc117fdf2513543ec3edc /ishtar_common/models_imports.py
parent7d337092ccd6a10ab2dcd6eb6f58c2e07bcf7a34 (diff)
downloadIshtar-2d810b66963245d12ac9e7d754a1f9e134f5a507.tar.bz2
Ishtar-2d810b66963245d12ac9e7d754a1f9e134f5a507.zip
Import models: add target key groups to manage target key by group (self explanatory)
Diffstat (limited to 'ishtar_common/models_imports.py')
-rw-r--r--ishtar_common/models_imports.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/ishtar_common/models_imports.py b/ishtar_common/models_imports.py
index d638c76f1..065dfa4de 100644
--- a/ishtar_common/models_imports.py
+++ b/ishtar_common/models_imports.py
@@ -493,12 +493,31 @@ class ImportTarget(models.Model):
return self.associated_model.get_types()
+class TargetKeyGroup(models.Model):
+ """
+ Group of target keys for imports.
+ """
+ name = models.TextField(_(u"Name"), unique=True)
+ all_user_can_use = models.BooleanField(_(u"All user can user it"),
+ default=False)
+ all_user_can_modify = models.BooleanField(_(u"All user can modify it"),
+ default=False)
+ available = models.BooleanField(_(u"Available"), default=True)
+
+ class Meta:
+ verbose_name = _(u"Importer - Target key group")
+ verbose_name_plural = _(u"Importer - Target key groups")
+
+ def __unicode__(self):
+ return self.name
+
+
class TargetKey(models.Model):
"""
User's link between import source and ishtar database.
Also temporary used for GeneralType to point missing link before adding
them in ItemKey table.
- A targetkey connection can be create to be applied to on particular
+ A targetkey connection can be create to be applied to one particular
import (associated_import), one particular user (associated_user) or to all
imports (associated_import and associated_user are empty).
"""
@@ -508,10 +527,11 @@ class TargetKey(models.Model):
is_set = models.BooleanField(_(u"Is set"), default=False)
associated_import = models.ForeignKey('Import', blank=True, null=True)
associated_user = models.ForeignKey('IshtarUser', blank=True, null=True)
+ associated_group = models.ForeignKey(TargetKeyGroup, blank=True, null=True)
class Meta:
unique_together = ('target', 'key', 'associated_user',
- 'associated_import')
+ 'associated_import', 'associated_group')
verbose_name = _(u"Importer - Target key")
verbose_name_plural = _(u"Importer - Targets keys")