Automatic formatting of Django templates

I had the same pain and couldn’t find anything working well. There was an extension for sublimetext, but it only worked sometimes… So I put together an experimental one called djLint, which lints templates and can also format complete html template docs.
Assuming you use a custom file extension of “html.dj”, you can run

djlint /path --extension=html.dj --check

to see what it thinks about your files.