Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set search/query field in GenericForeignKeyModelField? #1298

Open
tylerecouture opened this issue Jun 15, 2022 · 1 comment
Open

How to set search/query field in GenericForeignKeyModelField? #1298

tylerecouture opened this issue Jun 15, 2022 · 1 comment

Comments

@tylerecouture
Copy link
Contributor

tylerecouture commented Jun 15, 2022

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
Copy link
Member

jpic commented Sep 9, 2022

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants