[Django]-How to format a number with specific number of digits?

9👍

Simplifying karthikr’s answer, you can leverage one of the already provided django template tags to accomplish this:

{{ number|stringformat:"04d" }}

Leave a comment