More Py3 compatibility fixes.
[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     raw_id_fields = ['membership']
24     inlines = [PaymentInline]
25
26 admin.site.register(models.Schedule, ScheduleAdmin)
27
28
29 class PaymentAdmin(admin.ModelAdmin):
30     list_display = ['payed_at', 'schedule']
31
32 admin.site.register(models.Payment, PaymentAdmin)
33
34
35 class MembershipAdmin(admin.ModelAdmin):
36     list_display = ['user']
37     raw_id_fields = ['user']
38     search_fields = ['user__username', 'user__email']
39
40 admin.site.register(models.Membership, MembershipAdmin)
41
42
43 admin.site.register(models.ReminderEmail, TranslationAdmin)