django-admin-autocomplete-filter icon indicating copy to clipboard operation
django-admin-autocomplete-filter copied to clipboard

field_name attr can not be used like 'article__supplier'

Open anufry opened this issue 6 years ago • 6 comments

It is OK when I am using field_name attr like field_name = 'article' but there is not possible to use it like field_name = 'article__supplier'

Product has no field named 'article__supplier'

anufry avatar Nov 07 '19 18:11 anufry

I wish also to have this feature! Voting for it.

skabbit avatar Apr 17 '20 09:04 skabbit

Checkout the latest pypi version 0.5 and have a look at this pull request.

farhan0581 avatar Apr 18 '20 19:04 farhan0581

I suggest not to close this issue, as https://github.com/farhan0581/django-admin-autocomplete-filter/pull/30 doesn't solve more general case where you span more than one relation (e.g. article__supplier__country)

olivierdalang avatar Apr 21 '20 21:04 olivierdalang

Sure ! I will try to work on that, if you get something feel free to contribute.

farhan0581 avatar Apr 25 '20 09:04 farhan0581

I think this should work in 0.6.1 now - is anyone aware of a situation where it does not?

jaredahern avatar Mar 01 '21 01:03 jaredahern

I noticed if you create an autocomplete filter via AutocompleteFilterFactory, it supports spanning across multiple relationships (e.g., article__supplier__country ) However, when I tried to use the normal constructor for AutocompleteFilter it gave me a field error. (I wanted to define my own filter on the queryset using the selected value.) Part of this might be my own confusion, but it's not necessarily documented well what is meant by parameter_name and field_name, which I think is a separate issue here. I was able to get around it by monkey patching the queryset method on the class created by the factory, but that's a bit awkward.

aawiegel avatar Apr 28 '21 00:04 aawiegel