summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2015-06-16 13:48:04 +0200
committerÉtienne Loks <etienne.loks@proxience.com>2015-06-16 13:48:04 +0200
commit55f0743c366c633127b19db1084cd3d71cc1cc00 (patch)
treee54c46f3a44583bd134df3fcdbd042649fbf339f /ishtar_common/models.py
parent43adb2fcc5c46783066423561b36448f2f45855c (diff)
parent35bad41efd18022a89f53c4cddc1f1e97a516f96 (diff)
downloadIshtar-55f0743c366c633127b19db1084cd3d71cc1cc00.tar.bz2
Ishtar-55f0743c366c633127b19db1084cd3d71cc1cc00.zip
Merge branch 'stable'
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 57d5a7e5e..b2e90310e 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -1219,15 +1219,21 @@ 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
+ them in ItemKey table.
+ A targetkey connection can be create to be applied to on particular
+ import (associated_import), one particular user (associated_user) or to all
+ imports (associated_import and associated_user are empty).
"""
target = models.ForeignKey(ImportTarget, related_name='keys')
key = models.TextField(_(u"Key"))
value = models.TextField(_(u"Value"), blank=True, null=True)
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)
class Meta:
- unique_together = ('target', 'key')
+ unique_together = ('target', 'key', 'associated_user',
+ 'associated_import')
verbose_name = _(u"Importer - Target key")
verbose_name_plural = _(u"Importer - Targets keys")
@@ -1389,8 +1395,8 @@ class Import(models.Model):
unicode(self.user))
def need_matching(self):
- return bool(ImporterType.objects.filter(pk=self.importer_type.pk,
- columns__targets__keys__is_set=False).count())
+ return bool(TargetKey.objects.filter(associated_import=self,
+ is_set=False).count())
def get_actions(self):
"""