django-admin-autocomplete-filter
django-admin-autocomplete-filter copied to clipboard
field_name attr can not be used like 'article__supplier'
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'
I wish also to have this feature! Voting for it.
Checkout the latest pypi version 0.5 and have a look at this pull request.
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)
Sure ! I will try to work on that, if you get something feel free to contribute.
I think this should work in 0.6.1 now - is anyone aware of a situation where it does not?
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.