[gen] While <obj>.<fieldName> allows to get the 'DB' value of some field, <obj>.getValue allows to get a variant of it, ie, the formatted version (via an internal call to field.getFormattedValue).

This commit is contained in:
Gaetan Delannay 2014-09-08 15:13:18 +02:00
parent 8aed007623
commit 71bc58a8b0
9 changed files with 67 additions and 36 deletions

View file

@ -533,12 +533,14 @@ class Field:
return self.default
return value
def getFormattedValue(self, obj, value, showChanges=False):
def getFormattedValue(self, obj, value, showChanges=False, language=None):
'''p_value is a real p_obj(ect) value from a field from this type. This
method returns a pretty, string-formatted version, for displaying
purposes. Needs to be overridden by some child classes. If
p_showChanges is True, the result must also include the changes that
occurred on p_value across the ages.'''
occurred on p_value across the ages. If the formatting implies
translating some elements, p_language will be used if given, the
user language else.'''
if self.isEmptyValue(obj, value): return ''
return value