djangosnippets.org: Latest snippets tagged with 'parsing'https://djangosnippets.org/tags/parsing/2010-03-15T19:21:35.761081-05:00FloatField with safe expression parsing
2010-03-15T19:21:35.761081-05:00joelegnerhttps://djangosnippets.org/snippets/1959/<p>This FloatField replacement allows users to enter math expressions, such as:</p>
<p>4/5 + sqrt(32)</p>
<p>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.</p>
<p>Reference:</p>
<p><a href="http://lybniz2.sourceforge.net/safeeval.html">http://lybniz2.sourceforge.net/safeeval.html</a></p>
<p>The available functions are listed herein. Note that …</p>
Freely redistributable