On May 25, 10:30 am, Pirate Pete <peters.stay...@gmail.com> wrote: > sorry for this one last question, > > do you have any idea how i would go about rounding these values and > converting them from numbers to *'s ? > > i tried using the round() function on the annotation however it kept > giving me a type error "a float is required." > > cheers
I'd probably do a custom template filter: @register filter def stars(value): return '*' * int(round(value)) (you need both int and round, as int always rounds down, so you need to do the rounding before converting to int). Then use it like this (after loading the library in the template): {{ video.rating_avg|stars }} -- DR. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.