Add create tickets action for orders.
This commit is contained in:
parent
7a2127d1ff
commit
55860efb8c
|
@ -144,6 +144,7 @@ class OrderAdmin(admin.ModelAdmin):
|
||||||
"mark_order_as_paid",
|
"mark_order_as_paid",
|
||||||
"mark_order_as_refunded",
|
"mark_order_as_refunded",
|
||||||
"mark_order_as_cancelled",
|
"mark_order_as_cancelled",
|
||||||
|
"create_tickets",
|
||||||
]
|
]
|
||||||
|
|
||||||
def mark_order_as_paid(self, request, queryset):
|
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"
|
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):
|
def get_user_email(obj):
|
||||||
return obj.order.user.email
|
return obj.order.user.email
|
||||||
|
|
Loading…
Reference in a new issue