From af98b456ef464b2d7234786e638c2a7025169da8 Mon Sep 17 00:00:00 2001 From: Gabriel Weng Date: Fri, 17 Jan 2025 17:20:28 -0500 Subject: [PATCH] Fix inconstencies with all_requests and rename all_requests to all --- backend/clubs/models.py | 6 +++--- backend/clubs/views.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/clubs/models.py b/backend/clubs/models.py index 6d02d2170..86d273081 100644 --- a/backend/clubs/models.py +++ b/backend/clubs/models.py @@ -1077,7 +1077,7 @@ def __str__(self): return "".format(self.query, self.created_at) -class Request(models.Model): +class JoinRequest(models.Model): """ Abstract base class for Membership Request and Ownership Request """ @@ -1097,7 +1097,7 @@ class Meta: unique_together = (("requester", "club"),) -class MembershipRequest(Request): +class MembershipRequest(JoinRequest): """ Used when users are not in the club but request membership from the owner """ @@ -1128,7 +1128,7 @@ def send_request(self, request=None): ) -class OwnershipRequest(Request): +class OwnershipRequest(JoinRequest): """ Represents a user's request to take ownership of a club """ diff --git a/backend/clubs/views.py b/backend/clubs/views.py index 6fbc91e06..ce7273c15 100644 --- a/backend/clubs/views.py +++ b/backend/clubs/views.py @@ -3943,7 +3943,7 @@ class OwnershipRequestManagementViewSet(viewsets.ModelViewSet): accept: Accept an ownership request as a club owner. - old_requests: + all: Return a list of ownership requests older than a week. Used by Superusers. """ @@ -3954,7 +3954,7 @@ class OwnershipRequestManagementViewSet(viewsets.ModelViewSet): lookup_field = "requester__username" def get_queryset(self): - if self.action != "all_requests": + if self.action != "all": return OwnershipRequest.objects.filter( club__code=self.kwargs["club_code"], withdrawn=False ) @@ -3997,7 +3997,7 @@ def accept(self, request, *args, **kwargs): return Response({"success": True}) @action(detail=False, methods=["get"], permission_classes=[IsSuperuser]) - def all_requests(self, request, *args, **kwargs): + def all(self, request, *args, **kwargs): """ View unaddressed ownership requests, sorted by date. ---