In earlier versions of django-autocomplete-light you could use a template to render each returned entry, which included the ability to insert custom HTML
I can't figure out how to do that using the regular API, so I'm trying to add it in.
So far I have a class like this which uses mark_safe
and the HTML is being passed through:
class TemplateRenderSelect2QuerySetView(autocomplete.Select2QuerySetView):
def get_result_label(self, result):
"""Return the label of a result."""
template = get_template("autocomplete_light/item.html")
context = Context({"item": result})
return mark_safe(template.render(context))
And the template autocomplete_light/item.html
is:
<b>{{ item.name }}</b>
But thats being rendered as:
But the JSON is correct with the right tags:
{"pagination": {"more": false}, "results": [{"text": "<b>Victoria</b>", "id": 11}]}
How can I get django-admin to render the HTML properly?
edit: I found some extra documentation on custom HTML and tried setting attrs={'data-html': 'true'}
against the widget, but its still not working