1 from django.contrib import admin
2 from modeltranslation.admin import TranslationAdmin
6 class PlanAdmin(admin.ModelAdmin):
7 list_display = ['min_amount', 'interval']
9 admin.site.register(models.Plan, PlanAdmin)
12 class PaymentInline(admin.TabularInline):
13 model = models.Payment
15 readonly_fields = ['payed_at']
18 class ScheduleAdmin(admin.ModelAdmin):
19 list_display = ['email', 'started_at', 'expires_at', 'plan', 'amount', 'is_active', 'is_cancelled']
20 list_search = ['email']
21 list_filter = ['is_active', 'is_cancelled']
22 date_hierarchy = 'started_at'
23 raw_id_fields = ['membership']
24 inlines = [PaymentInline]
26 admin.site.register(models.Schedule, ScheduleAdmin)
29 class PaymentAdmin(admin.ModelAdmin):
30 list_display = ['payed_at', 'schedule']
32 admin.site.register(models.Payment, PaymentAdmin)
35 class MembershipAdmin(admin.ModelAdmin):
36 list_display = ['user']
37 raw_id_fields = ['user']
38 search_fields = ['user__username', 'user__email']
40 admin.site.register(models.Membership, MembershipAdmin)
43 admin.site.register(models.ReminderEmail, TranslationAdmin)