]> git.sommitrealweird.co.uk Git - sommitrealweird.git/blobdiff - sommitrealweird/blog/views.py
update copyright years
[sommitrealweird.git] / sommitrealweird / blog / views.py
index 08b52670cb00ce3c15507d9e500e8b7631d7e7e8..841b1ca2d0d7a5e1e1419a26cc51de0ecbe29e68 100644 (file)
@@ -43,16 +43,19 @@ def blog_view(request, year=None, month=None, day=None, hour=None, minutes=None,
             year = int(year)
             month = int(month)
             day = int(day)
-            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
     else:
         entries = BlogEntry.objects.all()
         if year and month and day: