diff --git a/saas/backend/apps/subject_template/views.py b/saas/backend/apps/subject_template/views.py index d3b2feffa..fc9986b6c 100644 --- a/saas/backend/apps/subject_template/views.py +++ b/saas/backend/apps/subject_template/views.py @@ -12,6 +12,7 @@ from functools import wraps from typing import List +from django.shortcuts import get_object_or_404 from django.utils.translation import gettext as _ from drf_yasg.utils import swagger_auto_schema from pydantic import parse_obj_as @@ -374,7 +375,7 @@ class SubjectTemplateGroupViewSet(SubjectTemplateQueryMixin, GenericViewSet): tags=["subject-template"], ) def list(self, request, *args, **kwargs): - template = self.get_object() + template = get_object_or_404(self.queryset, pk=kwargs["id"]) subject_template_groups = list( SubjectTemplateGroup.objects.filter(template_id=template.id).values(