Make currency field renderer display negative amounts in parentheses
Also remove space between amount and dollar sign.
This commit is contained in:
parent
c7c2fecec0
commit
eb64e709c4
|
@ -214,14 +214,13 @@ class CurrencyFieldRenderer(formalchemy.FieldRenderer):
|
||||||
Sort of generic field renderer for currency values.
|
Sort of generic field renderer for currency values.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, field):
|
|
||||||
super(CurrencyFieldRenderer, self).__init__(field)
|
|
||||||
|
|
||||||
def render_readonly(self, **kwargs):
|
def render_readonly(self, **kwargs):
|
||||||
value = self.raw_value
|
value = self.raw_value
|
||||||
if value is None:
|
if value is None:
|
||||||
return ''
|
return ''
|
||||||
return '$ {:0,.2f}'.format(value)
|
if value < 0:
|
||||||
|
return "(${:0,.2f})".format(0 - value)
|
||||||
|
return "${:0,.2f}".format(value)
|
||||||
|
|
||||||
|
|
||||||
class YesNoFieldRenderer(CheckBoxFieldRenderer):
|
class YesNoFieldRenderer(CheckBoxFieldRenderer):
|
||||||
|
|
Loading…
Reference in a new issue