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

Custom search viewset doesn't work in Django >= 3.2

Open KaktusOnFire opened this issue 2 years ago • 1 comments

When i try to create custom view as its documented in README, i gets following error:

AttributeError: 'CustomSearchView' object has no attribute 'source_field'

and the search field shows nothing

KaktusOnFire avatar Sep 09 '22 12:09 KaktusOnFire

I got around this by adding source_field as an attribute on my CustomSearchView, and I just passed the name of the fk field. I added that to as_view call so that looks like CustomSearchView.as_view(model_admin=self, source_field='fk_field')

That almost worked and the last change was just that rather than ever using super.get_queryset() I wrote custom logic for filtering the get_queryset method

edcohen08 avatar Nov 17 '22 23:11 edcohen08