Open lsmith77 opened 9 months ago
Can you add the id in a GET param of the autocomplete url and then filter it out?
Here is the "solution" I found by inspecting the generated HTML but it feels very hacky:
forward=(
# Hacky workaround for https://github.com/yourlabs/django-autocomplete-light/issues/1346
forward.Field("children-__prefix__-parent", "ignore_id"),
forward.Field("language"),
),
It seems like children-__prefix__-parent
contains the ID I need.
I have not figured out how I can dynamically add a GET parameter.
I want to prevent being abel to select the model itself.
But
forward.Field("id", "ignore_id"),
doesn't work since there is no "id" form field. What is the easiest way to handle this?I guess I could write a javascript handler to look at the URL, but maybe there is a simpler way to achieve this.