Open millioner opened 2 years ago
self.term, self.model_admin, self.source_field, _ = self.process_request(request)
File "...django/contrib/admin/views/autocomplete.py", line 82, in process_request
model_admin = self.admin_site._registry[remote_model]
AttributeError: 'NoneType' object has no attribute '_registry'
Yep, my bad. Docs are bit updated now.
@millioner I tested but this doesn't fix the issues for django>=3.2. Thanks for the PR btw!
Custom autocomplete view fails with
Django>=3.2
This code
Gives this error:
The reason:
django.contrib.admin.views.AutocompleteJsonView
class creates themodel_admin
property only during a requst processing.Here is the commit in the Django repo - https://github.com/django/django/commit/3071660acfbdf4b5c59457c8e9dc345d5e8894c5