From bd175f9b85ea5e0cb5e0966e474ec2bcaf405457 Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 5 Aug 2024 18:23:57 -0400 Subject: [PATCH] fix label printing --- auctions/models.py | 3 ++- auctions/views.py | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/auctions/models.py b/auctions/models.py index e422e88..7755b88 100755 --- a/auctions/models.py +++ b/auctions/models.py @@ -723,7 +723,8 @@ def median_lot_price(self): @property def lots_qs(self): """All lots in this auction""" - return Lot.objects.exclude(is_deleted=True).filter(auction=self.pk) + #return Lot.objects.exclude(is_deleted=True).filter(auction=self.pk) + return Lot.objects.exclude(is_deleted=True).filter(auctiontos_seller__auction__pk=self.pk) @property def total_sold_lots(self): diff --git a/auctions/views.py b/auctions/views.py index 94719dd..be832a3 100755 --- a/auctions/views.py +++ b/auctions/views.py @@ -4864,9 +4864,7 @@ def dispatch(self, request, *args, **kwargs): if self.print_only_unprinted: self.queryset = self.auction.unprinted_labels_qs else: - self.queryset = self.auction.labels_qs - for lot in self.queryset: - print(lot) + self.queryset = self.auction.lots_qs self.queryset = self.queryset.filter(auctiontos_seller__pk__in=self.selected_tos) if not self.get_queryset(): if not self.selected_tos: @@ -4874,7 +4872,13 @@ def dispatch(self, request, *args, **kwargs): else: messages.error(request, "Couldn't find any labels to print") return redirect(reverse('auction_printing', kwargs={'slug':self.auction.slug})) - return super().dispatch(request, *args, **kwargs) + if request.method.lower() in self.http_method_names: + handler = getattr( + self, request.method.lower(), self.http_method_not_allowed + ) + else: + handler = self.http_method_not_allowed + return handler(request, *args, **kwargs) class PickupLocationsIncoming(View, AuctionPermissionsMixin): """All lots destined for this location"""