mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-07-07 12:16:30 +00:00
56 lines
1.1 KiB
Python
56 lines
1.1 KiB
Python
from django.contrib import admin
|
|
from .models import Payment, BillFormula, Topup
|
|
|
|
# Register your models here.
|
|
|
|
|
|
class PaymentAdmin(admin.ModelAdmin):
|
|
list_display = (
|
|
"id",
|
|
"user",
|
|
"amount",
|
|
"number_of_months",
|
|
"paid",
|
|
"paid_at",
|
|
"method",
|
|
"is_expired",
|
|
"expires_at",
|
|
"created_at",
|
|
"updated_at",
|
|
)
|
|
|
|
@admin.display(boolean=True, description="Expired")
|
|
def is_expired(self, obj):
|
|
return obj.is_expired
|
|
|
|
|
|
class TopupAdmin(admin.ModelAdmin):
|
|
list_display = (
|
|
"id",
|
|
"user",
|
|
"amount",
|
|
"paid",
|
|
"paid_at",
|
|
"status",
|
|
"created_at",
|
|
"is_expired",
|
|
"expires_at",
|
|
"updated_at",
|
|
)
|
|
|
|
search_fields = (
|
|
"user__first_name",
|
|
"user__last_name",
|
|
"user__id_card",
|
|
"user__mobile",
|
|
)
|
|
|
|
@admin.display(boolean=True, description="Expired")
|
|
def is_expired(self, obj):
|
|
return obj.is_expired
|
|
|
|
|
|
admin.site.register(Payment, PaymentAdmin)
|
|
admin.site.register(BillFormula)
|
|
admin.site.register(Topup, TopupAdmin)
|