From 3124c3b6beee71a7e6699264647ec3b1872d7ba1 Mon Sep 17 00:00:00 2001 From: Keannu Bernasol Date: Sun, 24 Sep 2023 21:17:25 +0800 Subject: [PATCH] Removed duplicate codeblock in views and return error if Student Status is active in StudyGroupListNearView --- stude/study_groups/views.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/stude/study_groups/views.py b/stude/study_groups/views.py index 0f308d8..7523373 100644 --- a/stude/study_groups/views.py +++ b/stude/study_groups/views.py @@ -21,11 +21,6 @@ class StudyGroupListView(generics.ListAPIView): def get_queryset(self): user = self.request.user - if not user.is_student: - raise PermissionDenied( - "You must be a student to view study groups" - ) - if not user.is_student: raise PermissionDenied( "You must be a student to view study groups" @@ -57,7 +52,7 @@ class StudyGroupListView(generics.ListAPIView): group_radius = max(group_radius, 15) # Annotate the group with the radius group.radius = group_radius - + print('test', studygroups) return studygroups @@ -72,9 +67,6 @@ class StudyGroupListNearView(generics.ListAPIView): user_location = fromstr( user_status.location, srid=4326) - if user_status.active is False: - raise exceptions.ValidationError("Student Status is not active") - if not user.is_student: raise PermissionDenied( "You must be a student to view study groups"