33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
from django.contrib import admin
|
|
|
|
from .models import Claim, ClaimLog, Project
|
|
|
|
|
|
class ClaimLogInline(admin.TabularInline):
|
|
model = ClaimLog
|
|
extra = 0
|
|
readonly_fields = ("action", "from_status", "to_status", "note", "performed_by", "created_at")
|
|
can_delete = False
|
|
|
|
|
|
@admin.register(Claim)
|
|
class ClaimAdmin(admin.ModelAdmin):
|
|
list_display = ("full_name", "amount", "currency", "project", "status", "created_at", "submitted_by")
|
|
list_filter = ("status", "created_at", "project")
|
|
search_fields = ("full_name", "email", "description")
|
|
readonly_fields = ("created_at", "updated_at")
|
|
inlines = [ClaimLogInline]
|
|
|
|
|
|
@admin.register(ClaimLog)
|
|
class ClaimLogAdmin(admin.ModelAdmin):
|
|
list_display = ("claim", "action", "from_status", "to_status", "performed_by", "created_at")
|
|
list_filter = ("action", "to_status", "created_at")
|
|
|
|
|
|
@admin.register(Project)
|
|
class ProjectAdmin(admin.ModelAdmin):
|
|
list_display = ("name", "code", "is_active", "updated_at")
|
|
list_filter = ("is_active",)
|
|
search_fields = ("name", "code")
|