diff options
Diffstat (limited to 'ishtar_common')
| -rw-r--r-- | ishtar_common/models.py | 5 | ||||
| -rw-r--r-- | ishtar_common/views.py | 9 | 
2 files changed, 14 insertions, 0 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index d8948d3e3..bbd2923a0 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")) +    tiny_label = models.CharField(_(u"Tiny label"), max_length=50, +                                  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_tiny_label(self): +        return self.tiny_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 diff --git a/ishtar_common/views.py b/ishtar_common/views.py index e05d63db3..0624d13d0 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -542,6 +542,15 @@ def get_item(model, func_name, default_name, extra_request_keys=[],                      table_cols += model.EXTRA_FULL_FIELDS              else:                  table_cols = model.TABLE_COLS + +        # contextual (full, simple, etc.) col +        contxt = full and 'full' or 'simple' +        if hasattr(model, 'CONTEXTUAL_TABLE_COLS') and \ +                contxt in model.CONTEXTUAL_TABLE_COLS: +            for idx, col in enumerate(table_cols): +                if col in model.CONTEXTUAL_TABLE_COLS[contxt]: +                    table_cols[idx] = model.CONTEXTUAL_TABLE_COLS[contxt][col] +          # manage sort tables          manual_sort_key = None          order = request_items.get('sord')  | 
