X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/4b86e623b0ff7a5a53bdb29df06eab039ebe4e1e..6592ad610dc42a6242b5d5446addfb7a1feb01e0:/src/club/admin.py diff --git a/src/club/admin.py b/src/club/admin.py index bfa433006..ce94a094e 100644 --- a/src/club/admin.py +++ b/src/club/admin.py @@ -1,3 +1,6 @@ +# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# from django.contrib import admin from modeltranslation.admin import TranslationAdmin from . import models @@ -9,32 +12,44 @@ class PlanAdmin(admin.ModelAdmin): admin.site.register(models.Plan, PlanAdmin) -class PaymentInline(admin.TabularInline): - model = models.Payment +class PayUOrderInline(admin.TabularInline): + model = models.PayUOrder extra = 0 - readonly_fields = ['payed_at'] + show_change_link = True + + +class PayUCardTokenInline(admin.TabularInline): + model = models.PayUCardToken + extra = 0 + show_change_link = True class ScheduleAdmin(admin.ModelAdmin): - list_display = ['email', 'started_at', 'expires_at', 'plan', 'amount', 'is_active', 'is_cancelled'] + list_display = ['email', 'started_at', 'expires_at', 'plan', 'amount', 'is_cancelled'] list_search = ['email'] - list_filter = ['is_active', 'is_cancelled'] + list_filter = ['is_cancelled'] date_hierarchy = 'started_at' - inlines = [PaymentInline] + raw_id_fields = ['membership'] + inlines = [PayUOrderInline, PayUCardTokenInline] admin.site.register(models.Schedule, ScheduleAdmin) -class PaymentAdmin(admin.ModelAdmin): - list_display = ['payed_at', 'schedule'] - -admin.site.register(models.Payment, PaymentAdmin) - +class ScheduleInline(admin.TabularInline): + model = models.Schedule + extra = 0 + show_change_link = True class MembershipAdmin(admin.ModelAdmin): - pass + list_display = ['user'] + raw_id_fields = ['user'] + search_fields = ['user__username', 'user__email', 'schedule__email'] + inlines = [ScheduleInline] admin.site.register(models.Membership, MembershipAdmin) admin.site.register(models.ReminderEmail, TranslationAdmin) + + +admin.site.register(models.PayUNotification)