Leading zeros in django

         ·     

I am always forgetting about the stringformatting tag in Django’s templating language. For instance for leading zeros:

<br /> {{ variable|stringformat:“02d” }}<br />

This will always put a leading zero.

comments powered by Disqus