def content(request, template_name='index'):
try:
return direct_to_template(request, '%s.html' % template_name)
except TemplateDoesNotExist:
raise Http404
I'm having difficulty conceptualizing how to do this in trunk (1.4) with TemplateResponse. Since everything happens inside response.render() outside of the view, I do not have that level of control at this stage.
Should I extend BaseLoader to load the 404 template instead of raising an exception if it is not found? Or should I extend SimpleTemplateResponse to do something similar? Or is there a better way to do this?
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment