I need to add ability to search or filter inline data (admin.TabularInline)
class CommandsInline(admin.TabularInline):
model = Command
readonly_fields = ('id', 'owner_phone_version', 'operation', 'command', 'options', 'created')
exclude = ('owner', 'token', 'owner_phone', 'parameter', 'value')
extra = 0
max_num = 0
ordering = ('-created',)
def command(self, instance):
return format_html(mark_safe("<b>%s</b>=%s" % (instance.parameter, instance.value)))
def owner_phone_version(self, instance):
return format_html(mark_safe("<b>%s</b>. <em>%s</em>" % (instance.owner_phone.id, instance.owner_phone.version)))
I tried to add list_search and list_filter to the definition, but it has no effect inside django admin.
Any suggestions?
Here are the available options for
admin.TabularInline
: django docYou probably want to use
filter_horizontal
andfilter_vertical