diff --git a/src/backend/joanie/core/admin.py b/src/backend/joanie/core/admin.py index 5b63bdc311..cd0dab43b1 100644 --- a/src/backend/joanie/core/admin.py +++ b/src/backend/joanie/core/admin.py @@ -55,6 +55,19 @@ class CertificateAdmin(admin.ModelAdmin): """Admin class for the Certificate model""" list_display = ("order", "issued_on") + readonly_fields = ("order", "issued_on", "certificate_definition") + + def certificate_definition(self, obj): # pylint: disable=no-self-use + """Retrieve the certification definition from the related order.""" + certificate_definition = obj.order.product.certificate_definition + + return format_html( + ( + f"" + f"{str(certificate_definition)}" + "" + ) + ) @admin.register(models.Course) @@ -260,7 +273,7 @@ class OrderAdmin(DjangoObjectActions, admin.ModelAdmin): """Admin class for the Order model""" list_display = ("uid", "owner", "product", "state") - readonly_fields = ("total", "invoice") + readonly_fields = ("total", "invoice", "certificate") change_actions = (ACTION_NAME_GENERATE_CERTIFICATES,) actions = (ACTION_NAME_CANCEL, ACTION_NAME_GENERATE_CERTIFICATES)