Permalink
Browse files

Set initial value to Money type for SimpleMoneyField

  • Loading branch information...
1 parent fbc04bb commit 919a698fb8eae17c14e6590f7594315d4264f70a Danny Han committed Feb 15, 2012
Showing with 1 addition and 0 deletions.
  1. +1 −0 money/contrib/django/forms/fields.py
@@ -39,6 +39,7 @@ def __init__(self, decimal_places=2, max_digits=12, *args, **kwargs):
self.currency = kwargs.pop('currency')
self.widget = CurrencyTextInput()
super(SimpleMoneyField, self).__init__(*args, decimal_places=2, max_digits=12, **kwargs)
+ self.initial = Money(amount=self.initial, currency=self.currency)
def prepare_value(self, value):
if isinstance(value, Money):

0 comments on commit 919a698

Please sign in to comment.