Merge branch 'dev' into plugins-browsertrix
This commit is contained in:
commit
17fdf137a8
1 changed files with 4 additions and 3 deletions
|
@ -6,6 +6,7 @@ from contextlib import redirect_stdout
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django.db.models import Count
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from django.utils.html import format_html
|
from django.utils.html import format_html
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
|
@ -105,7 +106,7 @@ class SnapshotAdmin(SearchResultsAdminMixin, admin.ModelAdmin):
|
||||||
|
|
||||||
def get_queryset(self, request):
|
def get_queryset(self, request):
|
||||||
self.request = request
|
self.request = request
|
||||||
return super().get_queryset(request).prefetch_related('tags')
|
return super().get_queryset(request).prefetch_related('tags').annotate(archiveresult_count=Count('archiveresult'))
|
||||||
|
|
||||||
def tag_list(self, obj):
|
def tag_list(self, obj):
|
||||||
return ', '.join(obj.tags.values_list('name', flat=True))
|
return ', '.join(obj.tags.values_list('name', flat=True))
|
||||||
|
@ -187,7 +188,7 @@ class SnapshotAdmin(SearchResultsAdminMixin, admin.ModelAdmin):
|
||||||
def files(self, obj):
|
def files(self, obj):
|
||||||
return snapshot_icons(obj)
|
return snapshot_icons(obj)
|
||||||
|
|
||||||
files.admin_order_field = 'updated'
|
files.admin_order_field = 'archiveresult_count'
|
||||||
files.short_description = 'Files Saved'
|
files.short_description = 'Files Saved'
|
||||||
|
|
||||||
def size(self, obj):
|
def size(self, obj):
|
||||||
|
@ -204,7 +205,7 @@ class SnapshotAdmin(SearchResultsAdminMixin, admin.ModelAdmin):
|
||||||
size_txt,
|
size_txt,
|
||||||
)
|
)
|
||||||
|
|
||||||
size.admin_order_field = 'archiveresult__count'
|
size.admin_order_field = 'archiveresult_count'
|
||||||
|
|
||||||
def url_str(self, obj):
|
def url_str(self, obj):
|
||||||
return format_html(
|
return format_html(
|
||||||
|
|
Loading…
Reference in a new issue