Can we use django's templating engine to do all this more intuitively?