From 837734a655e2765f469ae04b45ec5537ec83c965 Mon Sep 17 00:00:00 2001 From: Dariusz Niemczyk Date: Tue, 11 Jul 2023 16:18:49 +0200 Subject: [PATCH] Fix admin not searching properly and make it great --- storage/admin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/admin.py b/storage/admin.py index d2404ce..8903dab 100644 --- a/storage/admin.py +++ b/storage/admin.py @@ -46,7 +46,7 @@ class ItemAdmin(ModelAdminMixin, admin.ModelAdmin): inlines = [ItemImageInline, LabelInline] save_on_top = True autocomplete_fields = ["parent"] - search_fields = ["parent"] + search_fields = ["name"] def _name(self, obj): return ("-" * (obj.get_level() or 0)) + "> " + obj.name @@ -77,6 +77,7 @@ class ItemAdmin(ModelAdminMixin, admin.ModelAdmin): class NormalModelAdmin(ModelAdminMixin, admin.ModelAdmin): + search_fields = ["name"] pass