aboutsummaryrefslogtreecommitdiffstats
path: root/account/admin.py
diff options
context:
space:
mode:
Diffstat (limited to 'account/admin.py')
-rw-r--r--account/admin.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/account/admin.py b/account/admin.py
index f491104..fe6fca1 100644
--- a/account/admin.py
+++ b/account/admin.py
@@ -113,10 +113,15 @@ class UserProfileAdmin(admin.ModelAdmin):
"""
return the html code of transcript with url link
"""
- return format_html('<a href="%(url)s">%(name)s</a>' % {
- 'url': obj.transcript.url,
- 'name': os.path.basename(obj.transcript.name),
- })
+ transcript = obj.transcript
+ if transcript:
+ html = '<a href="%(url)s">%(name)s</a>' % {
+ 'url': transcript.url,
+ 'name': os.path.basename(transcript.name),
+ }
+ else:
+ html = _("Null")
+ return format_html(html)
transcript_url.short_description = _("Transcript")
def attachments(self, obj):