mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-27 21:24:16 -04:00
Improved tags
This commit is contained in:
parent
0158efb1d0
commit
62c9028212
11 changed files with 172 additions and 10 deletions
archivebox/core
|
@ -66,6 +66,12 @@ class SnapshotAdmin(admin.ModelAdmin):
|
|||
actions = [delete_snapshots, overwrite_snapshots, update_snapshots, update_titles, verify_snapshots]
|
||||
actions_template = 'admin/actions_as_select.html'
|
||||
|
||||
def get_queryset(self, request):
|
||||
return super().get_queryset(request).prefetch_related('tags')
|
||||
|
||||
def tag_list(self, obj):
|
||||
return u", ".join(o.name for o in obj.tags.all())
|
||||
|
||||
def id_str(self, obj):
|
||||
return format_html(
|
||||
'<code style="font-size: 10px">{}</code>',
|
||||
|
@ -75,9 +81,9 @@ class SnapshotAdmin(admin.ModelAdmin):
|
|||
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 ''
|
||||
format_html(' <span>{}</span> ', tag)
|
||||
for tag in obj.tags.all()
|
||||
) if obj.tags.all() else ''
|
||||
return format_html(
|
||||
'<a href="/{}">'
|
||||
'<img src="/{}/{}" class="favicon" onerror="this.remove()">'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue