Skip to content

Instantly share code, notes, and snippets.

@ftao
Created September 11, 2012 08:46
Show Gist options
  • Save ftao/3696988 to your computer and use it in GitHub Desktop.
Save ftao/3696988 to your computer and use it in GitHub Desktop.
django floatformat problem
f: {{ f|floatformat:9}}
<br/>
f2: {{ f2|floatformat:9}}
<br/>
d: {{ d|floatformat:9}}
<br/>
s: {{ s|floatformat:9}}
def test_view(request):
from decimal import Decimal
data = {
'f' : 1346901083.549548149,
'f2' : 65534.549548149,
'd' : Decimal(1346901083.549548149),
's' : "1346901083.549548149",
}
return render_to_response('test/test.html',
data,
context_instance=RequestContext(request))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment