summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-07-17 13:34:39 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-07-17 13:34:39 +0200
commitb8222c46cee9f850b9f7c85c95500db256598abe (patch)
tree982882e05a2dea5ba0051d084531d6148e060c70 /ishtar_common
parent76d44b2cc907ca0e99b14f1ca0aa5f83ff261b3f (diff)
downloadIshtar-b8222c46cee9f850b9f7c85c95500db256598abe.tar.bz2
Ishtar-b8222c46cee9f850b9f7c85c95500db256598abe.zip
Context records: short_label -> tiny_label, explicit relation in exports
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/models.py8
-rw-r--r--ishtar_common/views.py9
2 files changed, 13 insertions, 4 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 1e878d2a1..bbd2923a0 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -728,8 +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)
+ 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,
@@ -744,8 +744,8 @@ 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 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)
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')