Login

Tag "floatfield"

Snippet List

FloatField with safe expression parsing

This FloatField replacement allows users to enter math expressions, such as: 4/5 + sqrt(32) And will evaluate them safely when the field's clean() function is called. In the example above, it will evaluate to a float value of about 6.457. Reference: [http://lybniz2.sourceforge.net/safeeval.html](http://lybniz2.sourceforge.net/safeeval.html) The available functions are listed herein. Note that the from __future__ import division causes integer division expressions to be evaluated as floats. For example "1/2" evaluates as 0.5 when it would otherwise have evaluated to 0 (assuming Python 2.X).

  • fields
  • forms
  • parser
  • math
  • eval
  • parsing
  • floatfield
Read More

1 snippet posted so far.