Fix admin not searching properly and make it great
This commit is contained in:
parent
45ad9bf88c
commit
837734a655
|
@ -46,7 +46,7 @@ class ItemAdmin(ModelAdminMixin, admin.ModelAdmin):
|
||||||
inlines = [ItemImageInline, LabelInline]
|
inlines = [ItemImageInline, LabelInline]
|
||||||
save_on_top = True
|
save_on_top = True
|
||||||
autocomplete_fields = ["parent"]
|
autocomplete_fields = ["parent"]
|
||||||
search_fields = ["parent"]
|
search_fields = ["name"]
|
||||||
|
|
||||||
def _name(self, obj):
|
def _name(self, obj):
|
||||||
return ("-" * (obj.get_level() or 0)) + "> " + obj.name
|
return ("-" * (obj.get_level() or 0)) + "> " + obj.name
|
||||||
|
@ -77,6 +77,7 @@ class ItemAdmin(ModelAdminMixin, admin.ModelAdmin):
|
||||||
|
|
||||||
|
|
||||||
class NormalModelAdmin(ModelAdminMixin, admin.ModelAdmin):
|
class NormalModelAdmin(ModelAdminMixin, admin.ModelAdmin):
|
||||||
|
search_fields = ["name"]
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue