From d3ac5bc8bc0bced054de067a1df5395b5e503e23 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Tue, 7 Feb 2012 15:06:24 +0100 Subject: [PATCH] allow configuration of display value for relation fields --- expert/field.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/expert/field.py b/expert/field.py index e1de141..ab21814 100644 --- a/expert/field.py +++ b/expert/field.py @@ -51,6 +51,7 @@ class UrlField(Field): class RelationField(Field): renderer = 'target' + displayAttribute = 'title' def getValue(self, row): return self.getRawValue(row) @@ -60,7 +61,7 @@ class RelationField(Field): if value is None: return dict(title=u'', url=u'') nv = row.parent.context.view.nodeView - return dict(title=value.title, + return dict(title=getattr(value, self.displayAttribute), url=nv.getUrlForTarget(baseObject(value)))