Permalink
Browse files

correct generating error 404 if is not post

  • Loading branch information...
1 parent f207b50 commit b62b9ea1d7477c759201d85fc3555b6d2bf8fe00 @d1ffuz0r committed Oct 18, 2011
Showing with 2 additions and 1 deletion.
  1. +2 −1 homesite/views.py
View
3 homesite/views.py
@@ -1,4 +1,5 @@
from django.core.paginator import Paginator, InvalidPage, EmptyPage
+from django.shortcuts import get_object_or_404
from models import Services, Portfolio, Settings, About, Blog
from homesite.forms import QuickContactForm
from django.http import HttpResponse
@@ -48,7 +49,7 @@ def blog_list(request):
@render_to('post.html')
def blog_post(request,post_id):
- post = Blog.objects.get(id = post_id)
+ post = get_object_or_404(Blog, id = post_id)
return {'page': 'blog', 'post': post}
def quick_form(request):

0 comments on commit b62b9ea

Please sign in to comment.