diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-07-17 11:01:06 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-07-17 11:01:06 +0200 |
commit | 76d44b2cc907ca0e99b14f1ca0aa5f83ff261b3f (patch) | |
tree | e32336136bc25a37f94d07700eb950ef7204a97b /ishtar_common | |
parent | 5e7cda4fe8902979dac8a8008908accb8f0bfab4 (diff) | |
download | Ishtar-76d44b2cc907ca0e99b14f1ca0aa5f83ff261b3f.tar.bz2 Ishtar-76d44b2cc907ca0e99b14f1ca0aa5f83ff261b3f.zip |
Add a short label to record relations
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/models.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index d8948d3e3..1e878d2a1 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -728,6 +728,8 @@ class BaseHistorizedItem(Imported): class GeneralRelationType(GeneralType): order = models.IntegerField(_(u"Order"), default=1) symmetrical = models.BooleanField(_(u"Symmetrical")) + short_label = models.CharField(_(u"Short label"), max_length=100, + blank=True, null=True) # # an inverse must be set # inverse_relation = models.ForeignKey( # 'RelationType', verbose_name=_(u"Inverse relation"), blank=True, @@ -742,6 +744,9 @@ class GeneralRelationType(GeneralType): raise ValidationError( _(u"Cannot have symmetrical and an inverse_relation")) + def get_short_label(self): + return self.short_label or self.label or u"" + def save(self, *args, **kwargs): obj = super(GeneralRelationType, self).save(*args, **kwargs) # after saving check that the inverse_relation of the inverse_relation |