From 8b0250caebb4ddaf46d4ad3721e403e7652cae43 Mon Sep 17 00:00:00 2001 From: JDC Date: Tue, 17 Nov 2020 08:36:03 -0500 Subject: [PATCH] Fixes 500 error on search The class SnapshotAdmin search_fields includes the tags ManyToMany field causing a django.core.exceptions.FieldError: Related Field got invalid lookup: icontains error. A related search field tags__name should be used. --- archivebox/core/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/archivebox/core/admin.py b/archivebox/core/admin.py index 20def353..b15507a4 100644 --- a/archivebox/core/admin.py +++ b/archivebox/core/admin.py @@ -86,7 +86,7 @@ class SnapshotAdmin(admin.ModelAdmin): list_display = ('added', 'title_str', 'url_str', 'files', 'size') sort_fields = ('title_str', 'url_str', 'added') readonly_fields = ('id', 'url', 'timestamp', 'num_outputs', 'is_archived', 'url_hash', 'added', 'updated') - search_fields = ('url', 'timestamp', 'title', 'tags') + search_fields = ['url', 'timestamp', 'title', 'tags__name'] fields = (*readonly_fields, 'title', 'tags') list_filter = ('added', 'updated', 'tags') ordering = ['-added']