Skip to content

Commit

Permalink
Allow users to see their own expired sublets
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-Jess committed Mar 24, 2024
1 parent 0905840 commit b6f777e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion backend/sublet/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ def list(self, request, *args, **kwargs):
beds = params.get("beds", None)
baths = params.get("baths", None)

queryset = Sublet.objects.all().filter(expires_at__gte=timezone.now())
queryset = self.get_queryset()

# Apply filters based on query parameters
if title:
queryset = queryset.filter(title__icontains=title)
Expand All @@ -151,6 +152,8 @@ def list(self, request, *args, **kwargs):
queryset = queryset.filter(amenities__name=amenity)
if subletter.lower() == "true":
queryset = queryset.filter(subletter=request.user)
else:
queryset = queryset.filter(expires_at__gte=timezone.now())
if starts_before:
queryset = queryset.filter(start_date__lt=starts_before)
if starts_after:
Expand Down

0 comments on commit b6f777e

Please sign in to comment.