Skip to content

Commit b50007d

Browse files
authored
Grant admin: show included reimbursements on changelist (#4599)
1 parent 62df6d5 commit b50007d

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

backend/grants/admin.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ class GrantAdmin(ExportMixin, ConferencePermissionMixin, admin.ModelAdmin):
475475
"conference",
476476
"current_or_pending_status",
477477
"total_amount_display",
478+
"approved_amounts_display",
478479
"country_type",
479480
"user_has_ticket",
480481
"has_voucher",
@@ -680,14 +681,16 @@ def has_sent_invitation_letter_request(self, obj: Grant) -> bool:
680681
return ""
681682

682683
@admin.display(description="Total")
683-
def total_amount_display(self, obj):
684-
return f"{obj.total_allocated_amount:.2f}"
685-
686-
@admin.display(description="Approved Reimbursements")
687-
def approved_amounts_display(self, obj):
688-
return ", ".join(
689-
f"{r.category.name}: {r.granted_amount}" for r in obj.reimbursements.all()
684+
def total_amount_display(self, obj: Grant) -> str:
685+
return f"{obj.total_allocated_amount:.0f}"
686+
687+
@admin.display(description="Included reimbursements")
688+
def approved_amounts_display(self, obj: Grant) -> str:
689+
text = ", ".join(
690+
f"{r.category.name}: {r.granted_amount:.0f}"
691+
for r in obj.reimbursements.all()
690692
)
693+
return text or "—"
691694

692695
def get_queryset(self, request):
693696
qs = (

0 commit comments

Comments
 (0)