Skip to content

Commit

Permalink
Fix inconstencies with all_requests and rename all_requests to all
Browse files Browse the repository at this point in the history
  • Loading branch information
gabeweng committed Jan 17, 2025
1 parent ecd4de6 commit af98b45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions backend/clubs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ def __str__(self):
return "<SearchQuery: {} at {}>".format(self.query, self.created_at)


class Request(models.Model):
class JoinRequest(models.Model):
"""
Abstract base class for Membership Request and Ownership Request
"""
Expand All @@ -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
"""
Expand Down Expand Up @@ -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
"""
Expand Down
6 changes: 3 additions & 3 deletions backend/clubs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand All @@ -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
)
Expand Down Expand Up @@ -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.
---
Expand Down

0 comments on commit af98b45

Please sign in to comment.