Division within django templates

1,865 views
Skip to first unread message

Jason

unread,
Feb 19, 2012, 11:03:25 AM2/19/12
to django...@googlegroups.com
Hi there,

i'm currently using the widthratio tag for division within a django template as detailed here: http://slacy.com/blog/2010/07/using-djangos-widthratio-template-tag-for-multiplication-division/. However, it only returns integer values. Is there something equally smart I can use to return floats, as some of the numbers I am calculating are < 1 and 0 gets returned...

Cheers,
J

Bill Freeman

unread,
Feb 19, 2012, 3:21:44 PM2/19/12
to django...@googlegroups.com
Yes. Use a model method. Don't do serious calculation in templates.

> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/GGL4EeyWFQsJ.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.

Reply all
Reply to author
Forward
0 new messages