bfa4330064c460fd771a883c87addad15a048902
[wolnelektury.git] / src / club / admin.py
1 from django.contrib import admin
2 from modeltranslation.admin import TranslationAdmin
3 from . import models
4
5
6 class PlanAdmin(admin.ModelAdmin):
7     list_display = ['min_amount', 'interval']
8
9 admin.site.register(models.Plan, PlanAdmin)
10
11
12 class PaymentInline(admin.TabularInline):
13     model = models.Payment
14     extra = 0
15     readonly_fields = ['payed_at']
16
17
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     inlines = [PaymentInline]
24
25 admin.site.register(models.Schedule, ScheduleAdmin)
26
27
28 class PaymentAdmin(admin.ModelAdmin):
29     list_display = ['payed_at', 'schedule']
30
31 admin.site.register(models.Payment, PaymentAdmin)
32
33
34 class MembershipAdmin(admin.ModelAdmin):
35     pass
36
37 admin.site.register(models.Membership, MembershipAdmin)
38
39
40 admin.site.register(models.ReminderEmail, TranslationAdmin)