I want to write custom filter with drop down field using admin_searchable_dropdown
I tried two ways too implement this and got error both times
first:
the custom filter
class PrimaryLabelFilter(AutocompleteFilter):
field_name = 'primary_label'
title = 'primary_label'
in the admin using it like this
list_filter = (
PrimaryLabelFilter,
)
the error
Forbidden (Permission denied): /admin/autocomplete/
model_admin = self.admin_site._registry[remote_model]
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: <class 'panel.backend.ad.models.label.Label'>
HTTP GET /admin/autocomplete/?app_label=ad&model_name=ad&field_name=primary_label 403 [0.01, 127.0.0.1:52324]
second:
in admin class
list_filter = (
('primary_label', PrimaryLabelFilter),
)
the error
<class 'panel.backend.ad.admin.ad.AdAdmin'>: (admin.E115) The value of 'list_filter[0][1]' must inherit from 'FieldListFilter'.