You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

36 lines
845 B

from django.contrib import admin
from polymorphic.admin import (
PolymorphicParentModelAdmin,
PolymorphicChildModelAdmin,
PolymorphicChildModelFilter,
)
from .models import CoursePayment, SchoolPayment, Payment
class PaymentChildAdmin(PolymorphicChildModelAdmin):
base_model = Payment
show_in_index = True
base_fieldsets = (
(None, {'fields': ('user', 'amount', 'status', 'data',)}),
)
@admin.register(CoursePayment)
class CoursePaymentAdmin(PaymentChildAdmin):
base_model = CoursePayment
@admin.register(SchoolPayment)
class SchoolPaymentAdmin(PaymentChildAdmin):
base_model = SchoolPayment
@admin.register(Payment)
class PaymentAdmin(PolymorphicParentModelAdmin):
base_model = Payment
polymorphic_list = True
child_models = (
CoursePayment,
SchoolPayment,
)