diff options
| author | Bobby <[email protected]> | 2023-01-30 01:10:28 -0500 |
|---|---|---|
| committer | Bobby <[email protected]> | 2023-01-30 01:10:28 -0500 |
| commit | 18bebda10a4f52cf1370fe51cca6bef685f48df3 (patch) | |
| tree | d391fddab94f62c7e3446625db33b05434788230 | |
| parent | 96d5446f193199e92fc45552073ee5b66f1151b7 (diff) | |
| download | thatcomputerscientist-18bebda10a4f52cf1370fe51cca6bef685f48df3.tar.xz thatcomputerscientist-18bebda10a4f52cf1370fe51cca6bef685f48df3.zip | |
raise 404 on not found articles
| -rw-r--r-- | blog/views.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/blog/views.py b/blog/views.py index 5a89064c..bc08db7e 100644 --- a/blog/views.py +++ b/blog/views.py @@ -124,9 +124,9 @@ def post(request, slug): if request.user.is_authenticated and request.user.is_superuser or request.user.is_staff: return render(request, 'blog/post.html', {'title': post.title, 'post': post, 'tags': tags, 'comments': comments}) else: - return HttpResponse('Post not found!', status=404) + raise Http404 except Post.DoesNotExist: - return HttpResponse('Post not found!', status=404) + raise Http404 def comment(request, slug): if request.method == 'POST': |
