Fix admin not searching properly and make it great

This commit is contained in:
Dariusz Niemczyk 2023-07-11 16:18:49 +02:00
parent 45ad9bf88c
commit 837734a655
No known key found for this signature in database
GPG Key ID: 28DFE7164F497CB6
1 changed files with 2 additions and 1 deletions

View File

@ -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