2👍
Thousands of rows is not that bad, plus I’m not aware of any django builtin function to achieve this. Even if it has one, it might as well does the same thing as you currently have. The best you can do is to create a custom django template filter to do it, it might make your life a little easier.
Source:stackexchange.com