Skip to content

Commit

Permalink
throw 404 if bad authority for ror question view
Browse files Browse the repository at this point in the history
  • Loading branch information
struan committed Dec 19, 2024
1 parent 9bd6523 commit 863ecd3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crowdsourcer/views/rightofreply.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from django.core.exceptions import PermissionDenied
from django.http import HttpResponse
from django.shortcuts import redirect
from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse
from django.views.generic import ListView

Expand Down Expand Up @@ -224,7 +224,8 @@ def get_initial_obj(self):

def check_permissions(self):
denied = True
authority = PublicAuthority.objects.get(name=self.kwargs["name"])
authority = get_object_or_404(PublicAuthority, name=self.kwargs["name"])

user = self.request.user

if user.is_anonymous:
Expand Down

0 comments on commit 863ecd3

Please sign in to comment.