From 81d6a57b26dee485bd5d78647e53b4e2c659001d Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Sat, 4 Jun 2022 21:25:23 -0500 Subject: [PATCH] Fix bug --- judge/views/organization.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/judge/views/organization.py b/judge/views/organization.py index 9a5b52b..2288d96 100644 --- a/judge/views/organization.py +++ b/judge/views/organization.py @@ -15,6 +15,7 @@ from django.http import ( HttpResponseRedirect, HttpResponseBadRequest, ) +from django.shortcuts import get_object_or_404 from django.urls import reverse from django.utils import timezone from django.utils.safestring import mark_safe @@ -120,7 +121,7 @@ class OrganizationMixin(OrganizationBase): def dispatch(self, request, *args, **kwargs): try: self.organization_id = int(kwargs["pk"]) - self.organization = Organization.objects.get(id=self.organization_id) + self.organization = get_object_or_404(Organization, id=self.organization_id) except Http404: key = kwargs.get(self.slug_url_kwarg, None) if key: