diff --git a/auctions/templates/view_lot_images.html b/auctions/templates/view_lot_images.html
index 2d69d3c..e4c3f3b 100755
--- a/auctions/templates/view_lot_images.html
+++ b/auctions/templates/view_lot_images.html
@@ -423,15 +423,18 @@
Exchange info
{% if request.user.is_authenticated %}
{% if is_auction_admin %}
-
-
{% endif %}
+ {% if is_auction_admin or lot.user.pk == request.user.pk%}
+ {% if lot.label_printed%}Reprint label{% else %}Print label{% endif %}
+ {% endif %}
{% endif %}
{% if request.user.is_superuser %}
Admin
diff --git a/auctions/urls.py b/auctions/urls.py
index e43ba46..22de152 100755
--- a/auctions/urls.py
+++ b/auctions/urls.py
@@ -55,6 +55,7 @@
path('lots/new/', login_required(views.LotCreateView.as_view()), name='new_lot'),
path('lots/watched/', login_required(views.MyWatched.as_view()), name='watched'),
path('lots/won/', login_required(views.MyWonLots.as_view()), name="won_lots"),
+ path('lots/print//', login_required(views.SingleLotLabelView.as_view()), name="single_lot_label"),
path('selling', login_required(views.MyLots.as_view()), name='selling'),
path('lots/all/', views.AllLots.as_view(), name='allLots'),
path('lots/user/', views.LotsByUser.as_view(), name="user_lots"),
diff --git a/auctions/views.py b/auctions/views.py
index c9bd650..7e559e5 100755
--- a/auctions/views.py
+++ b/auctions/views.py
@@ -3704,6 +3704,26 @@ class UnprintedLotLabelsView(LotLabelView):
def get_queryset(self):
return self.tos.unprinted_labels_qs
+class SingleLotLabelView(LotLabelView):
+ """Reprint labels for just one lot"""
+
+ def get_queryset(self):
+ return Lot.objects.filter(pk=self.lot.pk)
+
+ def dispatch(self, request, *args, **kwargs):
+ self.lot = get_object_or_404(Lot, pk=kwargs.pop('pk'), is_deleted=False)
+ if self.lot.auctiontos_seller and self.lot.auctiontos_seller.user is not request.user:
+ self.auction = self.lot.auctiontos_seller.auction
+ if not self.is_auction_admin:
+ messages.error(request, "You can't print lables for other people's lots unless you are an admin")
+ return redirect("/")
+ if not self.lot.auctiontos_seller:
+ if self.lot.user and self.lot.user is not request.user:
+ messages.error(request, "You can only print labels for your own lots")
+ return redirect("/")
+ # super() would try to find an auction
+ return View.dispatch(self, request, *args, **kwargs)
+
@login_required
def getClubs(request):
if request.method == 'POST':