yourlabs/django-autocomplete-light

How to set search/query field in GenericForeignKeyModelField?

tylerecouture opened this issue · 1 comments

Is there a way to set the search field on a model when using the GenericForeignKeyModelField, similar to how you can with the Select2GenericForeignKeyModelField by passing a tuples to model_choices?

In a GenericForeignKeyModelField that second part of the tuple (the search field) gets ignored and still looks for a "name" field regardless.

Thanks!

jpic commented

I see copy and pasted code, but I don't use that at this time... meanwhile reviews are open for refactoring pull requests.
I'm trying to refactor this from the ground up by generalizing the as_url() system, but I'm experimenting combining that with djhacker.formfield at the same time while we're at it so the whole chain is automated at once, in the spirit of DAL v2, but without the un-maintainable code I did naively at that time 10 years ago.
Pushed to as_url branch but I'm not done there...