feat: improve operations admin
This commit is contained in:
+11
-1
@@ -29,8 +29,10 @@ class PointsLedgerAdmin(ReadOnlyLedgerAdmin):
|
||||
"ref_call",
|
||||
)
|
||||
list_filter = ("change_type", "created_at")
|
||||
search_fields = ("user__username", "user__email", "reason")
|
||||
search_fields = ("user__username", "user__email", "=ref_order_id", "reason")
|
||||
ordering = ("-created_at", "-id")
|
||||
date_hierarchy = "created_at"
|
||||
list_select_related = ("user", "ref_call")
|
||||
|
||||
|
||||
@admin.register(PricingRule)
|
||||
@@ -47,6 +49,7 @@ class PricingRuleAdmin(admin.ModelAdmin):
|
||||
search_fields = ("alias", "resolution")
|
||||
ordering = ("operation_type", "alias", "resolution")
|
||||
readonly_fields = ("created_at", "updated_at")
|
||||
list_editable = ("points_cost", "is_active")
|
||||
|
||||
@admin.display(description="resolution")
|
||||
def resolution_display(self, obj):
|
||||
@@ -66,6 +69,8 @@ class ExchangeRateAdmin(admin.ModelAdmin):
|
||||
search_fields = ("currency", "note")
|
||||
ordering = ("-effective_from", "-id")
|
||||
readonly_fields = ("created_at", "updated_at")
|
||||
list_editable = ("is_active",)
|
||||
date_hierarchy = "effective_from"
|
||||
|
||||
|
||||
@admin.register(RechargeOrder)
|
||||
@@ -90,6 +95,8 @@ class RechargeOrderAdmin(ReadOnlyLedgerAdmin):
|
||||
"payment_txn_no",
|
||||
)
|
||||
ordering = ("-created_at", "-id")
|
||||
date_hierarchy = "created_at"
|
||||
list_select_related = ("user",)
|
||||
|
||||
|
||||
@admin.register(CallRecord)
|
||||
@@ -112,8 +119,11 @@ class CallRecordAdmin(ReadOnlyLedgerAdmin):
|
||||
"api_key__key_prefix",
|
||||
"alias",
|
||||
"model_used",
|
||||
"prompt",
|
||||
"error_message",
|
||||
"result_ref",
|
||||
"result_summary",
|
||||
)
|
||||
ordering = ("-created_at", "-id")
|
||||
date_hierarchy = "created_at"
|
||||
list_select_related = ("user", "api_key")
|
||||
|
||||
Reference in New Issue
Block a user