def get_document_field_display(self, field_name, field):
        document = getattr(self.instance, field_name)
        if document:
            return mark_safe(
                '<a href="%s">%s <span class="meta">(%s, %s)</span></a>' % (
                    document.url,
                    document.title,
                    document.file_extension.upper(),
                    filesizeformat(document.file.size),
                )
            )
        return self.model_admin.get_empty_value_display(field_name)
Render a link to a document
dataset/ETHPy150Open torchbox/wagtail/wagtail/contrib/modeladmin/views.py/InspectView.get_document_field_display