Exibindo o erro 404 (página não encontrada) com django.http.Http404 (Not Found)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from typing import Any
|
||||
|
||||
from blog.data import posts
|
||||
from django.http import HttpRequest
|
||||
from django.http import Http404, HttpRequest
|
||||
from django.shortcuts import render
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ def post(request: HttpRequest, post_id: int):
|
||||
break
|
||||
|
||||
if found_post is None:
|
||||
raise Exception('Post não existe.')
|
||||
raise Http404('Post não existe.')
|
||||
|
||||
context = {
|
||||
# 'text': 'Olá blog',
|
||||
|
||||
Reference in New Issue
Block a user