2022-07-21 12:45:44 +00:00
|
|
|
from django.contrib import admin
|
|
|
|
from django.contrib.auth.admin import UserAdmin
|
|
|
|
|
|
|
|
from .forms import CustomUserCreationForm
|
2022-07-21 12:48:39 +00:00
|
|
|
from .models import Plan, Session, User
|
2022-07-21 12:45:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Register your models here.
|
|
|
|
class CustomUserAdmin(UserAdmin):
|
|
|
|
list_filter = ["plans"]
|
|
|
|
model = User
|
|
|
|
add_form = CustomUserCreationForm
|
|
|
|
fieldsets = (
|
|
|
|
*UserAdmin.fieldsets,
|
|
|
|
(
|
|
|
|
"Stripe information",
|
2022-07-21 12:48:39 +00:00
|
|
|
{"fields": ("stripe_id",)},
|
2022-07-21 12:45:44 +00:00
|
|
|
),
|
|
|
|
(
|
|
|
|
"Payment information",
|
|
|
|
{
|
|
|
|
"fields": (
|
|
|
|
"plans",
|
|
|
|
"last_payment",
|
|
|
|
)
|
|
|
|
},
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
admin.site.register(User, CustomUserAdmin)
|
2022-07-21 12:45:57 +00:00
|
|
|
admin.site.register(Plan)
|
2022-07-21 12:48:39 +00:00
|
|
|
admin.site.register(Session)
|