Merge pull request #854 from Gluejar/deactivate-cards
allow admin to deactivate card accountspull/94/head
commit
69e2eb69ba
|
@ -1,5 +1,5 @@
|
|||
from django.contrib.admin import ModelAdmin, site
|
||||
from .models import Transaction, PaymentResponse, Receiver
|
||||
from .models import Transaction, PaymentResponse, Receiver, Account
|
||||
|
||||
class TransactionAdmin(ModelAdmin):
|
||||
list_display = ('campaign', 'user', 'amount', 'status', 'error')
|
||||
|
@ -11,8 +11,25 @@ class PaymentResponseAdmin(ModelAdmin):
|
|||
class ReceiverAdmin(ModelAdmin):
|
||||
ordering = ('email',)
|
||||
|
||||
def deactivate(modeladmin, request, queryset):
|
||||
for obj in queryset:
|
||||
obj.deactivate()
|
||||
|
||||
class AccountAdmin(ModelAdmin):
|
||||
search_fields = ('user__username', 'user__email',)
|
||||
list_display = ('user', 'card_type', 'card_exp_year', 'status')
|
||||
readonly_fields = ('user', 'card_type', 'card_last4', 'card_exp_month', 'card_exp_year',
|
||||
'date_created', 'date_modified', 'date_deactivated', 'status')
|
||||
fields = readonly_fields
|
||||
actions = [deactivate]
|
||||
|
||||
def deactivate(self, request, queryset):
|
||||
for obj in queryset:
|
||||
obj.deactivate()
|
||||
|
||||
# payments
|
||||
|
||||
site.register(Transaction, TransactionAdmin)
|
||||
site.register(PaymentResponse, PaymentResponseAdmin)
|
||||
site.register(Receiver, ReceiverAdmin)
|
||||
site.register(Account, AccountAdmin)
|
||||
|
|
Loading…
Reference in New Issue