farhan0581 / django-admin-autocomplete-filter

A simple Django app to render list filters in django admin using autocomplete widget.
GNU General Public License v3.0
351 stars 76 forks source link

Django 3.2 autocomplete view compatibility #77

Closed browniebroke closed 2 years ago

browniebroke commented 2 years ago

While trying to upgrade to Django 3.2, I noticed that this package stopped working. The call to Django's autocomplete endpoint started to return 403 errors, originating from this try/catch block

https://github.com/django/django/blob/e01b383e021d37e1b7ee62f1cf2e490fb849b95d/django/contrib/admin/views/autocomplete.py#L60-L65

Upon further investigation, it turns out Django moved the autocomplete endpoint in https://github.com/django/django/pull/11026. In 3.1, each model admin had its own autocomplete view (e.g. /admin/app_label/model_name/autocomplete/), while in 3.2, there is a single autocomplete view attached to the admin site (/admin/autocomplete/) and the app_label + model name should be passed as query parameters instead of in the URL route.

Is it something that's supposed to be handled by this package? I tried to search for existing issues and PR but nothing came up. I'm already running the latest version.

browniebroke commented 2 years ago

The problem wasn't with this library, it was actually in django-grappelli. I was using 2.15.1 which were missing a few important fixes for autocomplete, I fixed it all by upgrading to the latest version compatible with Django 3.2 (2.15.5).