Refactor logic out of the django tags

For this code to be more reusable, logic needs to be outside the tags.

This branch does that for most tags, plus adds a couple of naïve replacements for Django's ``conditional_escape`` and ``force_unicode``

Since I am not very familiar with Django templatetags, if any branch was going to break stuff it's this one ;-)