Posts tagged #python

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 actually need this.

»
Author's profile picture Nicu Surdu

Capture the Output of a Django Command

The documentation is very slim when it talks about how to call a Django command from code. In order 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.

»
Author's profile picture Nicu Surdu