Browse Source

Admin action for cancelling a subscription

pull/125/head
Pēteris Caune 8 years ago
parent
commit
638532adf4
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      hc/payments/admin.py

+ 7
- 1
hc/payments/admin.py View File

@ -9,7 +9,13 @@ class SubsAdmin(admin.ModelAdmin):
"payment_method_token", "subscription_id", "plan_id") "payment_method_token", "subscription_id", "plan_id")
list_filter = ("plan_id", ) list_filter = ("plan_id", )
actions = ("cancel", )
def email(self, obj): def email(self, obj):
return obj.user.email if obj.user else None return obj.user.email if obj.user else None
def cancel(self, request, qs):
for sub in qs.all():
sub.cancel()
self.message_user(request, "%d subscriptions cancelled" % qs.count())

Loading…
Cancel
Save