Skip to content

Instantly share code, notes, and snippets.

Created June 26, 2022 11:58
What would you like to do?
delete post
def delete_post(request: HttpRequest, slug: str) -> HttpResponse:
post = get_object_or_404(Post, slug=slug)
if request.method == "POST":
return redirect("index")
context = {"post": post}
return render(request, "delete_post.html", context)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment