mirror of
https://github.com/lemeow125/DRF_Template.git
synced 2024-11-17 12:19:24 +08:00
29 lines
1 KiB
Python
29 lines
1 KiB
Python
from django.contrib import admin
|
|
from subscriptions.models import StripePrice, SubscriptionPlan, UserSubscription
|
|
from unfold.admin import ModelAdmin
|
|
from unfold.contrib.filters.admin import RangeDateFilter
|
|
|
|
|
|
@admin.register(StripePrice)
|
|
class StripePriceAdmin(ModelAdmin):
|
|
search_fields = ["id", "lookup_key",
|
|
"stripe_price_id","price","currency", "prorated", "annual"]
|
|
list_display = ["id", "lookup_key",
|
|
"stripe_price_id", "price", "currency", "prorated", "annual"]
|
|
|
|
|
|
@admin.register(SubscriptionPlan)
|
|
class SubscriptionPlanAdmin(ModelAdmin):
|
|
list_display = ["id", "__str__", "stripe_product_id", "group_exclusive"]
|
|
search_fields = ["id", "name", "stripe_product_id", "group_exclusive"]
|
|
|
|
|
|
@admin.register(UserSubscription)
|
|
class UserSubscriptionAdmin(ModelAdmin):
|
|
list_filter_submit = True
|
|
list_filter = ((
|
|
"date", RangeDateFilter
|
|
),)
|
|
list_display = ["id", "__str__", "valid", "annual",
|
|
"date"]
|
|
search_fields = ["id", "date"]
|