from django.utils.safestring import mark_safe
t = loader.get_template('sometemplate')
c = Context({'foo': 'bar', 'url': mark_safe('http://127.0.0.1/test?a=1&b=2')})
print(t.render(c))
How to disable HTML encoding when using Context in django