- blog_entry = BlogEntry.objects.get(publish_date__year=year, publish_date__month=month, publish_date__day=day, slug__exact=slug)
- template_name = "blog/single_entry_%s.html" %(blog_entry.format,)
- t = loader.get_template(template_name)
- c = RequestContext(request,
- {
- "entry": blog_entry,
- "publish_date": blog_entry.publish_date
- }
- )
- return HttpResponse(t.render(c))
+ try:
+ blog_entry = BlogEntry.objects.get(publish_date__year=year, publish_date__month=month, publish_date__day=day, slug__exact=slug)
+ template_name = "blog/single_entry_%s.html" %(blog_entry.format,)
+ t = loader.get_template(template_name)
+ c = RequestContext(request,
+ {
+ "entry": blog_entry,
+ "publish_date": blog_entry.publish_date
+ }
+ )
+ return HttpResponse(t.render(c))
+ except:
+ raise Http404