40 lines
903 B
Python
40 lines
903 B
Python
|
from django.contrib import admin
|
||
|
from django.contrib.auth.admin import UserAdmin
|
||
|
|
||
|
from .forms import CustomUserCreationForm
|
||
|
from .models import Product, User
|
||
|
|
||
|
|
||
|
# Register your models here.
|
||
|
class CustomUserAdmin(UserAdmin):
|
||
|
list_filter = ["plans"]
|
||
|
model = User
|
||
|
add_form = CustomUserCreationForm
|
||
|
fieldsets = (
|
||
|
*UserAdmin.fieldsets,
|
||
|
(
|
||
|
"Stripe information",
|
||
|
{
|
||
|
"fields": (
|
||
|
"stripe_id",
|
||
|
"subscription_id",
|
||
|
)
|
||
|
},
|
||
|
),
|
||
|
(
|
||
|
"Payment information",
|
||
|
{
|
||
|
"fields": (
|
||
|
"subscription_active",
|
||
|
"paid",
|
||
|
"plans",
|
||
|
"last_payment",
|
||
|
)
|
||
|
},
|
||
|
),
|
||
|
)
|
||
|
|
||
|
|
||
|
admin.site.register(User, CustomUserAdmin)
|
||
|
admin.site.register(Product)
|