Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions backend/grants/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ class GrantAdmin(ExportMixin, ConferencePermissionMixin, admin.ModelAdmin):
"conference",
"current_or_pending_status",
"total_amount_display",
"approved_amounts_display",
"country_type",
"user_has_ticket",
"has_voucher",
Expand Down Expand Up @@ -680,14 +681,16 @@ def has_sent_invitation_letter_request(self, obj: Grant) -> bool:
return ""

@admin.display(description="Total")
def total_amount_display(self, obj):
return f"{obj.total_allocated_amount:.2f}"

@admin.display(description="Approved Reimbursements")
def approved_amounts_display(self, obj):
return ", ".join(
f"{r.category.name}: {r.granted_amount}" for r in obj.reimbursements.all()
def total_amount_display(self, obj: Grant) -> str:
return f"{obj.total_allocated_amount:.0f}"

@admin.display(description="Included reimbursements")
def approved_amounts_display(self, obj: Grant) -> str:
text = ", ".join(
f"{r.category.name}: {r.granted_amount:.0f}"
for r in obj.reimbursements.all()
)
return text or "—"

def get_queryset(self, request):
qs = (
Expand Down
Loading