From 55860efb8cfca54b8db621941bc21ff179c745ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Mon, 29 Jul 2019 22:32:49 +0200 Subject: [PATCH] Add create tickets action for orders. --- src/shop/admin.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/shop/admin.py b/src/shop/admin.py index 988bcd04..0a16c74c 100644 --- a/src/shop/admin.py +++ b/src/shop/admin.py @@ -144,6 +144,7 @@ class OrderAdmin(admin.ModelAdmin): "mark_order_as_paid", "mark_order_as_refunded", "mark_order_as_cancelled", + "create_tickets", ] def mark_order_as_paid(self, request, queryset): @@ -164,6 +165,12 @@ class OrderAdmin(admin.ModelAdmin): mark_order_as_cancelled.description = "Mark order(s) as cancelled" + def create_tickets(self, request, queryset): + for order in queryset.filter(paid=True): + order.create_tickets(request) + + create_tickets.description = "Create tickets for order(s) (paid only)" + def get_user_email(obj): return obj.order.user.email