Skip to content

Commit

Permalink
Merge pull request #518 from atleta/fix/currency_widget_handling
Browse files Browse the repository at this point in the history
Fixed currency_widget handling.
  • Loading branch information
benjaoming committed Oct 16, 2019
2 parents 8fe64d7 + 48446a5 commit 14f94cf
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions djmoney/forms/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,11 @@ def __init__(
)
currency_field = ChoiceField(choices=currency_choices)

# TODO: No idea what currency_widget is supposed to do since it doesn't
# even receive currency choices as input. Somehow it's supposed to be
# instantiated from outside. Hard to tell.
if currency_widget:
self.widget = currency_widget
else:
self.widget = MoneyWidget(
amount_widget=amount_field.widget,
currency_widget=currency_field.widget,
default_currency=default_currency,
)
self.widget = MoneyWidget(
amount_widget=amount_field.widget,
currency_widget=currency_widget or currency_field.widget,
default_currency=default_currency,
)
# The two fields that this widget comprises
fields = (amount_field, currency_field)
super(MoneyField, self).__init__(fields, *args, **kwargs)
Expand Down

0 comments on commit 14f94cf

Please sign in to comment.