Browse Source

Fix boolean display for autogen CRUD

pull/11/merge
Edward Ribeiro 9 years ago
parent
commit
a65922666d
  1. 3
      sapl/crud.py

3
sapl/crud.py

@ -52,10 +52,13 @@ def get_field_display(obj, fieldname):
value = getattr(obj, 'get_%s_display' % fieldname)() value = getattr(obj, 'get_%s_display' % fieldname)()
else: else:
value = getattr(obj, fieldname) value = getattr(obj, fieldname)
if value is None: if value is None:
display = '' display = ''
elif 'date' in str(type(value)): elif 'date' in str(type(value)):
display = value.strftime("%d/%m/%Y") display = value.strftime("%d/%m/%Y")
elif 'bool' in str(type(value)):
display = 'Sim' if value else 'Não'
else: else:
display = str(value) display = str(value)

Loading…
Cancel
Save