Changeset View
Changeset View
Standalone View
Standalone View
looper/admin.py
| Show First 20 Lines • Show All 478 Lines • ▼ Show 20 Lines | list_filter = [ | ||||
| 'created_at', | 'created_at', | ||||
| 'collection_method', | 'collection_method', | ||||
| 'collection_attempts', | 'collection_attempts', | ||||
| 'payment_method__gateway', | 'payment_method__gateway', | ||||
| 'payment_method__method_type', | 'payment_method__method_type', | ||||
| 'payment_method__is_deleted', | 'payment_method__is_deleted', | ||||
| 'transaction__failure_message', | 'transaction__failure_message', | ||||
| 'tax_type', | 'tax_type', | ||||
| 'refunded_at', | |||||
| ] | ] | ||||
| search_fields = ['id', 'email', *USER_SEARCH_FIELDS] | search_fields = ['id', 'email', *USER_SEARCH_FIELDS] | ||||
| actions = [mark_as_paid] | actions = [mark_as_paid] | ||||
| form = forms.OrderAdminForm | form = forms.OrderAdminForm | ||||
| raw_id_fields = ['user'] | raw_id_fields = ['user'] | ||||
| readonly_fields = [ | readonly_fields = [ | ||||
| user_link, | user_link, | ||||
| subscription_link, | subscription_link, | ||||
| payment_link, | payment_link, | ||||
| 'created_at', | 'created_at', | ||||
| 'updated_at', | 'updated_at', | ||||
| 'collection_attempts', | 'collection_attempts', | ||||
| 'tax_type', | 'tax_type', | ||||
| 'tax_rate', | 'tax_rate', | ||||
| 'tax_country', | 'tax_country', | ||||
| 'tax', | 'tax', | ||||
| 'vat_number', | 'vat_number', | ||||
| 'total_refunded', | 'refunded', | ||||
| 'number', | 'number', | ||||
| 'is_legacy', | 'is_legacy', | ||||
| legacy_link, | legacy_link, | ||||
| 'tax_refunded', | |||||
| 'refunded_at', | |||||
| ] | ] | ||||
| fieldsets = [ | fieldsets = [ | ||||
| ( | ( | ||||
| None, | None, | ||||
| { | { | ||||
| 'fields': [ | 'fields': [ | ||||
| user_link, | user_link, | ||||
| subscription_link, | subscription_link, | ||||
| payment_link, | payment_link, | ||||
| 'status', | 'status', | ||||
| 'name', | 'name', | ||||
| 'number', | 'number', | ||||
| 'is_legacy', | 'is_legacy', | ||||
| legacy_link, | legacy_link, | ||||
| ], | ], | ||||
| }, | }, | ||||
| ), | ), | ||||
| ( | ( | ||||
| 'Money', | 'Money', | ||||
| { | { | ||||
| 'fields': [ | 'fields': [ | ||||
| 'payment_method', | 'payment_method', | ||||
| 'collection_method', | ('collection_method', 'collection_attempts'), | ||||
| 'collection_attempts', | |||||
| 'currency', | 'currency', | ||||
| 'price', | ('price', 'refunded'), | ||||
| 'tax_type', | ('tax_type', 'tax_rate', 'tax_country'), | ||||
| 'tax_rate', | ('tax', 'tax_refunded'), | ||||
| 'tax_country', | |||||
| 'tax', | |||||
| 'vat_number', | 'vat_number', | ||||
| 'total_refunded', | |||||
| ], | ], | ||||
| }, | }, | ||||
| ), | ), | ||||
| ( | ( | ||||
| 'Dates', | 'Dates', | ||||
| { | { | ||||
| 'fields': ['created_at', 'updated_at', 'paid_at', 'retry_after'], | 'fields': ['created_at', 'updated_at', 'paid_at', 'refunded_at', 'retry_after'], | ||||
| 'classes': ('collapse',), | 'classes': ('collapse',), | ||||
| }, | }, | ||||
| ), | ), | ||||
| ( | ( | ||||
| 'Addresses', | 'Addresses', | ||||
| { | { | ||||
| 'fields': ['email', 'billing_address'], | 'fields': ['email', 'billing_address'], | ||||
| 'classes': ('collapse',), | 'classes': ('collapse',), | ||||
| }, | }, | ||||
| ), | ), | ||||
| ] | ] | ||||
| inlines = [ | inlines = [ | ||||
| TransactionsInline, | TransactionsInline, | ||||
| ] | ] | ||||
| def total_refunded(self, order: models.Order) -> str: | |||||
| refunded = order.total_refunded() | |||||
| if not refunded: | |||||
| return '-' | |||||
| return refunded.with_currency_symbol_nonocents() | |||||
| @admin.register(models.Transaction) | @admin.register(models.Transaction) | ||||
| class TransactionAdmin(admin.ModelAdmin): | class TransactionAdmin(admin.ModelAdmin): | ||||
| list_display = ( | list_display = ( | ||||
| 'id', | 'id', | ||||
| 'status', | 'status', | ||||
| 'created_at', | 'created_at', | ||||
| 'updated_at', | 'updated_at', | ||||
| ▲ Show 20 Lines • Show All 217 Lines • Show Last 20 Lines | |||||