Commit 7b3f1b03 by Clinton Blackburn

Updated BasketAdmin

Added read-only inline view of associated PaymentProcessor objects.
parent 916a5f23
from oscar.apps.basket.admin import * # noqa pylint: disable=wildcard-import,unused-wildcard-import from oscar.apps.basket.admin import * # noqa pylint: disable=wildcard-import,unused-wildcard-import
Basket = get_model('basket', 'basket')
PaymentProcessorResponse = get_model('payment', 'PaymentProcessorResponse')
class PaymentProcessorResponseInline(admin.TabularInline):
model = PaymentProcessorResponse
extra = 0
can_delete = False
readonly_fields = ('id', 'processor_name', 'transaction_id', 'created', 'response')
def has_add_permission(self, request):
# Users are not allowed to add PaymentProcessorResponse objects
return False
class BasketAdminExtended(BasketAdmin):
inlines = (LineInline, PaymentProcessorResponseInline,)
admin.site.unregister(Basket)
admin.site.register(Basket, BasketAdminExtended)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment