mirror of
https://github.com/i701/sarlink-portal-api.git
synced 2025-09-07 19:30:31 +00:00
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m42s
76 lines
1.6 KiB
Python
76 lines
1.6 KiB
Python
from django.contrib import admin
|
|
from .models import Payment, BillFormula, Topup, WalletTransaction
|
|
|
|
# Register your models here.
|
|
|
|
|
|
class WalletTransactionAdmin(admin.ModelAdmin):
|
|
list_display = (
|
|
"id",
|
|
"user",
|
|
"amount",
|
|
"transaction_type",
|
|
"description",
|
|
"reference_id",
|
|
"created_at",
|
|
)
|
|
search_fields = (
|
|
"user__first_name",
|
|
"user__last_name",
|
|
"user__mobile",
|
|
"user__id_card",
|
|
)
|
|
list_filter = ("transaction_type",)
|
|
|
|
|
|
class PaymentAdmin(admin.ModelAdmin):
|
|
list_display = (
|
|
"id",
|
|
"user",
|
|
"amount",
|
|
"number_of_months",
|
|
"paid",
|
|
"paid_at",
|
|
"method",
|
|
"created_at",
|
|
"expires_at",
|
|
"is_expired",
|
|
"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)
|
|
admin.site.register(WalletTransaction, WalletTransactionAdmin)
|