python - django-money form field in unit test -
i using django-money , have money field (value = moneyfield(…)
) want test in model form. code:
def test_post_valid(self): data = {'value': money('99.99', currency='gbp'), } response = self.client.post(url, data)
i error in form parsing code stating:
(pdb++) form.errors {u'value': [u'this field required.']}
what correct format?
django-money
hack moneyfield
, doesn't translate simple html form field, , instead produces 2 html form fields value , currency code.
you have pass value
of type decimal
(or value can coerced decimal
) , value_currency
of 3-character currency code (choicefield
of country codes).
def test_post_valid(self): data = {'value_0': '99.99', 'value_1': 'gbp' } response = self.client.post(url, data)
Comments
Post a Comment