mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2024-11-17 06:19:24 +08:00
Removed duplicate codeblock in views and return error if Student Status is active in StudyGroupListNearView
This commit is contained in:
parent
05d12073d4
commit
3124c3b6be
1 changed files with 1 additions and 9 deletions
|
@ -21,11 +21,6 @@ class StudyGroupListView(generics.ListAPIView):
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
user = self.request.user
|
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:
|
if not user.is_student:
|
||||||
raise PermissionDenied(
|
raise PermissionDenied(
|
||||||
"You must be a student to view study groups"
|
"You must be a student to view study groups"
|
||||||
|
@ -57,7 +52,7 @@ class StudyGroupListView(generics.ListAPIView):
|
||||||
group_radius = max(group_radius, 15)
|
group_radius = max(group_radius, 15)
|
||||||
# Annotate the group with the radius
|
# Annotate the group with the radius
|
||||||
group.radius = group_radius
|
group.radius = group_radius
|
||||||
|
print('test', studygroups)
|
||||||
return studygroups
|
return studygroups
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,9 +67,6 @@ class StudyGroupListNearView(generics.ListAPIView):
|
||||||
user_location = fromstr(
|
user_location = fromstr(
|
||||||
user_status.location, srid=4326)
|
user_status.location, srid=4326)
|
||||||
|
|
||||||
if user_status.active is False:
|
|
||||||
raise exceptions.ValidationError("Student Status is not active")
|
|
||||||
|
|
||||||
if not user.is_student:
|
if not user.is_student:
|
||||||
raise PermissionDenied(
|
raise PermissionDenied(
|
||||||
"You must be a student to view study groups"
|
"You must be a student to view study groups"
|
||||||
|
|
Loading…
Reference in a new issue