Fix debug view blowing up when a template is not given to render()

See https://code.djangoproject.com/ticket/21058

First commit from DjangoCon 2013 by @jambonrose and @ianawilson