Skip to content

Commit

Permalink
fix(requests): respect request state on my-matches pages
Browse files Browse the repository at this point in the history
  • Loading branch information
thejoeejoee committed Nov 19, 2023
1 parent 38dda0c commit 43956df
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions fiesta/apps/buddy_system/views/matches.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.utils.translation import gettext_lazy as _
from django.views.generic import ListView

from apps.fiestarequests.models.request import BaseRequestProtocol
from apps.plugins.middleware.plugin import HttpRequest
from apps.sections.views.mixins.membership import EnsureLocalUserViewMixin
from apps.utils.breadcrumbs import with_breadcrumb, with_plugin_home_breadcrumb
Expand All @@ -16,6 +17,10 @@ class MyBuddies(EnsureLocalUserViewMixin, ListView):
template_name = "buddy_system/my_buddies.html"

def get_queryset(self):
return self.request.user.buddy_system_request_matches.prefetch_related(
"request__issuer__profile"
).select_related("request", "matcher")
return (
self.request.user.buddy_system_request_matches.prefetch_related("request__issuer__profile")
.select_related("request", "matcher")
.filter(
request__state=BaseRequestProtocol.State.MATCHED,
)
)
11 changes: 8 additions & 3 deletions fiesta/apps/pickup_system/views/matches.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django.utils.translation import gettext_lazy as _
from django.views.generic import ListView

from apps.fiestarequests.models.request import BaseRequestProtocol
from apps.plugins.middleware.plugin import HttpRequest
from apps.sections.views.mixins.membership import EnsureLocalUserViewMixin
from apps.utils.breadcrumbs import with_breadcrumb, with_plugin_home_breadcrumb
Expand All @@ -16,6 +17,10 @@ class MyPickups(EnsureLocalUserViewMixin, ListView):
template_name = "pickup_system/my_pickups.html"

def get_queryset(self):
return self.request.user.pickup_system_request_matches.prefetch_related(
"request__issuer__profile"
).select_related("request", "matcher")
return (
self.request.user.pickup_system_request_matches.prefetch_related("request__issuer__profile")
.select_related("request", "matcher")
.filter(
request__state=BaseRequestProtocol.State.MATCHED,
)
)

0 comments on commit 43956df

Please sign in to comment.