identities: for fields using a ChoiceWidget translate the options

This commit is contained in:
Benjamin Dauvergne 2014-01-13 14:37:16 +01:00
parent 6d7854d860
commit 2047b39309
1 changed files with 10 additions and 0 deletions

View File

@ -217,6 +217,16 @@ class Field:
value = keywords.pop('value', None)
if identity:
value = getattr(identity, self.key, value)
if 'options' in keywords:
# translate caption
new_options = []
for p in keywords['options']:
if isinstance(p, (list, tuple)):
p = (p[0], _(p[1]))
else:
p = _(p)
new_options.append(p)
keywords['options'] = new_options
if not self.read_only or admin:
if self.multivalued:
keywords['render_br'] = False