diff options
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 |