parent
221a637119
commit
6473b7b8a7
1 changed files with 34 additions and 1 deletions
@ -1,3 +1,36 @@ |
|||||||
from django.contrib import admin |
from django.contrib import admin |
||||||
|
from polymorphic.admin import ( |
||||||
|
PolymorphicParentModelAdmin, |
||||||
|
PolymorphicChildModelAdmin, |
||||||
|
PolymorphicChildModelFilter, |
||||||
|
) |
||||||
|
|
||||||
# Register your models here. |
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, |
||||||
|
) |
||||||
|
|||||||
Loading…
Reference in new issue