Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. area = forms.DecimalField(max_digits=20)
  2.  
  3. raise Exception(type(a.get('area',))
  4.  
  5. float(a.get('area', '0'))
  6.  
  7. area = form.data['area']
  8. #area should be <type 'unicode'>
  9. area_float = float(area)
  10.  
  11. a = u'1.34'
  12. a_float = float(a)
  13. type(a_float)
  14. >> <type 'float'>
  15.  
  16. if form.is_valid():
  17. # Form is valid, so do stuff with the form data
  18. # e.g. send email, save to DB etc.
  19. area = form.cleaned_data['area']
  20. # more code here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement