1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 from django.contrib import admin
5 from modeltranslation.admin import TranslationAdmin
9 class PlanAdmin(admin.ModelAdmin):
10 list_display = ['min_amount', 'interval']
12 admin.site.register(models.Plan, PlanAdmin)
15 class PayUOrderInline(admin.TabularInline):
16 model = models.PayUOrder
18 show_change_link = True
21 class PayUCardTokenInline(admin.TabularInline):
22 model = models.PayUCardToken
24 show_change_link = True
27 class ScheduleAdmin(admin.ModelAdmin):
28 list_display = ['email', 'started_at', 'expires_at', 'plan', 'amount', 'is_cancelled']
29 list_search = ['email']
30 list_filter = ['is_cancelled']
31 date_hierarchy = 'started_at'
32 raw_id_fields = ['membership']
33 inlines = [PayUOrderInline, PayUCardTokenInline]
35 admin.site.register(models.Schedule, ScheduleAdmin)
38 class ScheduleInline(admin.TabularInline):
39 model = models.Schedule
41 show_change_link = True
43 class MembershipAdmin(admin.ModelAdmin):
44 list_display = ['user']
45 raw_id_fields = ['user']
46 search_fields = ['user__username', 'user__email', 'schedule__email']
47 inlines = [ScheduleInline]
49 admin.site.register(models.Membership, MembershipAdmin)
52 admin.site.register(models.ReminderEmail, TranslationAdmin)
55 admin.site.register(models.PayUNotification)