How to Set a Variable in Django Template
As you may have figured by now, Django does not implement such a feature. That is because the logic of setting the variable must go in the view, not in the template. But there are some rare cases when you need this.
Capture the Output of a Django Command
The documentation is very slim when it talks about how to call a Django command from code. To do this, just use call_command. To solve the trick of capturing the output of this I had to dig a little into the Django source.