Ejemplo n.º 1
0
 def size(self, obj):
     return format_html(
         '<a href="/{}" title="View all files">{}</a>',
         obj.archive_path,
         printable_filesize(obj.archive_size)
         if obj.archive_size else 'pending',
     )
Ejemplo n.º 2
0
 def size(self, obj):
     archive_size = obj.archive_size
     if archive_size:
         size_txt = printable_filesize(archive_size)
         if archive_size > 52428800:
             size_txt = mark_safe(f'<b>{size_txt}</b>')
     else:
         size_txt = mark_safe('<span style="opacity: 0.3">...</span>')
     return format_html(
         '<a href="/{}" title="View all files">{}</a>',
         obj.archive_path,
         size_txt,
     )
Ejemplo n.º 3
0
 def size(self, obj):
     archive_size = obj.archive_size
     if archive_size:
         size_txt = printable_filesize(archive_size)
         if archive_size > 52428800:
             size_txt = mark_safe(f'<b>{size_txt}</b>')
     else:
         size_txt = 'pending'
     return format_html(
         '<a href="/{}" title="View all files">{}</a>',
         obj.archive_path,
         size_txt,
     )