mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-14 07:04:27 -04:00
fix favicon url and show size in separate column
This commit is contained in:
parent
fd0d0563d1
commit
022231b362
2 changed files with 17 additions and 13 deletions
|
@ -9,7 +9,7 @@ from archivebox.logging_util import printable_filesize
|
||||||
|
|
||||||
|
|
||||||
class SnapshotAdmin(admin.ModelAdmin):
|
class SnapshotAdmin(admin.ModelAdmin):
|
||||||
list_display = ('title_str', 'url_str', 'tags', 'files', 'added', 'updated')
|
list_display = ('title_str', 'url_str', 'tags', 'files', 'size', 'added', 'updated')
|
||||||
sort_fields = ('title_str', 'url_str', 'tags', 'added', 'updated')
|
sort_fields = ('title_str', 'url_str', 'tags', 'added', 'updated')
|
||||||
readonly_fields = ('id', 'num_outputs', 'is_archived', 'url_hash', 'added', 'updated')
|
readonly_fields = ('id', 'num_outputs', 'is_archived', 'url_hash', 'added', 'updated')
|
||||||
search_fields = ('url', 'timestamp', 'title', 'tags')
|
search_fields = ('url', 'timestamp', 'title', 'tags')
|
||||||
|
@ -33,7 +33,7 @@ class SnapshotAdmin(admin.ModelAdmin):
|
||||||
'<a href="/{}/{}">'
|
'<a href="/{}/{}">'
|
||||||
'<b>{}</b></a>',
|
'<b>{}</b></a>',
|
||||||
obj.archive_path,
|
obj.archive_path,
|
||||||
obj.archive_path, canon['google_favicon_path'],
|
obj.archive_path, canon['favicon_path'],
|
||||||
obj.archive_path, canon['wget_path'] or '',
|
obj.archive_path, canon['wget_path'] or '',
|
||||||
urldecode(htmldecode(obj.latest_title or obj.title or '-'))[:128],
|
urldecode(htmldecode(obj.latest_title or obj.title or '-'))[:128],
|
||||||
)
|
)
|
||||||
|
@ -42,15 +42,14 @@ class SnapshotAdmin(admin.ModelAdmin):
|
||||||
canon = obj.as_link().canonical_outputs()
|
canon = obj.as_link().canonical_outputs()
|
||||||
return format_html(
|
return format_html(
|
||||||
'<span style="font-size: 1.2em; opacity: 0.8">'
|
'<span style="font-size: 1.2em; opacity: 0.8">'
|
||||||
'<a href="/{}/{}">🌐 </a> '
|
'<a href="/{}/{}" title="Wget clone">🌐 </a> '
|
||||||
'<a href="/{}/{}">📄</a> '
|
'<a href="/{}/{}" title="PDF">📄</a> '
|
||||||
'<a href="/{}/{}">🖥 </a> '
|
'<a href="/{}/{}" title="Screenshot">🖥 </a> '
|
||||||
'<a href="/{}/{}">🅷 </a> '
|
'<a href="/{}/{}" title="HTML dump">🅷 </a> '
|
||||||
'<a href="/{}/{}">📼 </a> '
|
'<a href="/{}/{}" title="Media files">📼 </a> '
|
||||||
'<a href="/{}/{}">📦 </a> '
|
'<a href="/{}/{}" title="Git repos">📦 </a> '
|
||||||
'<a href="/{}/{}">🏛 </a> '
|
'<a href="/{}/{}" title="Archive.org snapshot">🏛 </a> '
|
||||||
'</span><br/>'
|
'</span>',
|
||||||
'<a href="/{}">{}</a>',
|
|
||||||
obj.archive_path, canon['wget_path'] or '',
|
obj.archive_path, canon['wget_path'] or '',
|
||||||
obj.archive_path, canon['pdf_path'],
|
obj.archive_path, canon['pdf_path'],
|
||||||
obj.archive_path, canon['screenshot_path'],
|
obj.archive_path, canon['screenshot_path'],
|
||||||
|
@ -58,6 +57,11 @@ class SnapshotAdmin(admin.ModelAdmin):
|
||||||
obj.archive_path, canon['media_path'],
|
obj.archive_path, canon['media_path'],
|
||||||
obj.archive_path, canon['git_path'],
|
obj.archive_path, canon['git_path'],
|
||||||
obj.archive_path, canon['archive_org_path'],
|
obj.archive_path, canon['archive_org_path'],
|
||||||
|
)
|
||||||
|
|
||||||
|
def size(self, obj):
|
||||||
|
return format_html(
|
||||||
|
'<a href="/{}" title="View all files">{}</a>',
|
||||||
obj.archive_path,
|
obj.archive_path,
|
||||||
printable_filesize(obj.archive_size) if obj.archive_size else 'pending',
|
printable_filesize(obj.archive_size) if obj.archive_size else 'pending',
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@ from django.contrib import admin
|
||||||
from django.urls import path, include
|
from django.urls import path, include
|
||||||
from django.views import static
|
from django.views import static
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.staticfiles import views
|
from django.contrib.staticfiles.views import serve as serve_static
|
||||||
from django.views.generic.base import RedirectView
|
from django.views.generic.base import RedirectView
|
||||||
|
|
||||||
from core.views import MainIndex, AddLinks, LinkDetails
|
from core.views import MainIndex, AddLinks, LinkDetails
|
||||||
|
@ -21,7 +21,7 @@ urlpatterns = [
|
||||||
path('archive/<path:path>', LinkDetails.as_view(), name='LinkAssets'),
|
path('archive/<path:path>', LinkDetails.as_view(), name='LinkAssets'),
|
||||||
path('add/', AddLinks.as_view(), name='AddLinks'),
|
path('add/', AddLinks.as_view(), name='AddLinks'),
|
||||||
|
|
||||||
path('static/<path>', views.serve),
|
path('static/<path>', serve_static),
|
||||||
|
|
||||||
path('accounts/login/', RedirectView.as_view(url='/admin/login/')),
|
path('accounts/login/', RedirectView.as_view(url='/admin/login/')),
|
||||||
path('accounts/logout/', RedirectView.as_view(url='/admin/logout/')),
|
path('accounts/logout/', RedirectView.as_view(url='/admin/logout/')),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue