I have a unique problem. I put the value "90 dollars" in my floatField. I assume that it should be cleaned and saved as "90.0" in the model.
but when I enter "$ 90" and call the clean_filed method, it does not call this clean method. but when I apply a breakpoint on a pure (self) mehthod and try to get its value, it says "No".
please help me. here is my code.
Model
class Project(models.Model):
foo = models.FloatField("foo",
null=True, blank=True
)
forms
widgets = {
'foo': forms.TextInput(attrs={'currency': 'true'})}
def clean_foo(self):
value = self.cleaned_data.get('foo')
print value
return value
source
share