I’m a pretty new Django developer and my experience with the framework so far has been great. I wanted to ask more senior developers what is considered best practices in this case:
I am writing a website for recipes and I would like to humanize the output for fractions, converting 1.5 to 1 1/2 and so forth. I’m not concerned with the algorithm that gets the correct fraction.
I’m trying to figure out if I should use a template filter (similar to django’s humanize https://docs.djangoproject.com/en/dev/ref/contrib/humanize/#ref-contrib-humanize) or should I generate the strings inside my view and return that instead.
As a general rule, you shouldn’t have any presentation logic in your view. This definitely belongs in a template filter.