diff --git a/crowdsourcer/views/rightofreply.py b/crowdsourcer/views/rightofreply.py index f9e753d..8a9fdbb 100644 --- a/crowdsourcer/views/rightofreply.py +++ b/crowdsourcer/views/rightofreply.py @@ -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 @@ -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: