Example #1
0
 def title_str(self, obj):
     canon = obj.as_link().canonical_outputs()
     tags = ''.join(
         format_html('<span>{}</span>', tag.strip())
         for tag in obj.tags.split(',')) if obj.tags else ''
     return format_html(
         '<a href="/{}">'
         '<img src="/{}/{}" class="favicon" onerror="this.remove()">'
         '</a>'
         '<a href="/{}/{}">'
         '<b class="status-{}">{}</b>'
         '</a>', obj.archive_path, obj.archive_path, canon['favicon_path'],
         obj.archive_path, canon['wget_path'] or '',
         'fetched' if obj.latest_title or obj.title else 'pending',
         urldecode(htmldecode(obj.latest_title or obj.title or ''))[:128]
         or 'Pending...') + mark_safe(f'<span class="tags">{tags}</span>')
Example #2
0
 def title_str(self, obj):
     canon = obj.as_link().canonical_outputs()
     tags = ''.join(
         format_html(
             '<a href="/admin/core/snapshot/?tags__id__exact={}"><span class="tag">{}</span></a> ',
             tag.id, tag) for tag in obj.tags.all() if str(tag).strip())
     return format_html(
         '<a href="/{}">'
         '<img src="/{}/{}" class="favicon" onerror="this.remove()">'
         '</a>'
         '<a href="/{}/index.html">'
         '<b class="status-{}">{}</b>'
         '</a>', obj.archive_path, obj.archive_path, canon['favicon_path'],
         obj.archive_path,
         'fetched' if obj.latest_title or obj.title else 'pending',
         urldecode(htmldecode(obj.latest_title or obj.title or ''))[:128]
         or 'Pending...') + mark_safe(f' <span class="tags">{tags}</span>')