Skip to content

Commit

Permalink
Add support for django-money MoneyField serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
cachitas committed Mar 19, 2019
1 parent 77e4922 commit 9d34c9c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyforms_web/controls/control_querylist.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ def format_list_column(self, col_value):
return locale.format("%f", col_value, grouping=True)
elif isinstance(col_value, Decimal):
return '{0:n}'.format(col_value)
elif type(col_value).__name__ == 'Money':
# support django-money MoneyField
return '<div style="text-align: right; margin-right: .5rem;">%s</div>' % col_value
elif isinstance(col_value, FieldFile ):
try:
return '<a href="{0}" target="_blank" click="return false;" >{1}</a>'.format(col_value.url, col_value.name)
Expand Down

0 comments on commit 9d34c9c

Please sign in to comment.