Skip to content

Commit

Permalink
fix: fix problem with 403 custom page
Browse files Browse the repository at this point in the history
  • Loading branch information
memorisanka committed Sep 18, 2024
1 parent 650f272 commit ba9ef5f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 7 deletions.
4 changes: 0 additions & 4 deletions core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
from .models import Community, CommunityMember, Post, PostVote, SavedPost


def custom_permission_denied_view(request: HttpRequest, exception: Exception | None = None) -> HttpResponse: # noqa: ARG001
return render(request, "core/403.html", status=403)


class PostListView(ListView):
template_name = "core/post-list.html"
context_object_name = "posts"
Expand Down
2 changes: 0 additions & 2 deletions reddit/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,3 @@

REST_FRAMEWORK = {"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.PageNumberPagination", "PAGE_SIZE": 10}
DEFAULT_AVATAR_URL = "/media/users_avatars/default.png"

handler403 = "core.views.custom_permission_denied_view"
2 changes: 1 addition & 1 deletion core/templates/core/403.html → templates/403.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="container mt-5">
<div class="card bg-dark shadow-sm text-light">
<div class="card-body">
<p class="card-text">You don't have access to this content.</p>
<p class="card-text">Ups... You don't have access to this community.</p>
<a href="{% url 'community-list' %}" class="btn btn-primary">Back to Community List</a>
</div>
</div>
Expand Down

0 comments on commit ba9ef5f

Please sign in to comment.