Skip to content

Commit

Permalink
chore: start omitting cancelled bids from auctions
Browse files Browse the repository at this point in the history
  • Loading branch information
sandronadiradze committed Nov 4, 2024
1 parent d0893e6 commit 0371afe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bid/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,9 @@ def get_queryset(self):
auction_id = self.kwargs.get("auction_id")
user_id = self.request.user.id

queryset = Bid.objects.exclude(status=StatusChoices.DELETED).prefetch_related(
"images"
)
queryset = Bid.objects.filter(
Q(status=StatusChoices.CANCELLED) | ~Q(status=StatusChoices.DELETED)
).prefetch_related("images")

if auction_id:
auction = get_object_or_404(Auction, id=auction_id, author=user_id)
Expand Down Expand Up @@ -539,9 +539,9 @@ def get_queryset(self):
# Base queryset: filter by user and exclude deleted bids
queryset = (
Bid.objects.filter(
author=user_id,
Q(author=user_id)
& (Q(status=StatusChoices.CANCELLED) | ~Q(status=StatusChoices.DELETED))
)
.exclude(status=StatusChoices.DELETED)
.select_related("auction")
.prefetch_related("images")
)
Expand Down

0 comments on commit 0371afe

Please sign in to comment.