Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete broken on Django 4 #164

Open
chrisdevilliers opened this issue Jun 24, 2022 · 3 comments
Open

Autocomplete broken on Django 4 #164

chrisdevilliers opened this issue Jun 24, 2022 · 3 comments

Comments

@chrisdevilliers
Copy link

I am unable to get autocomplete working in the admin interface on Django 4. To recreate the issue, follow the README.rst from the example/ directory:

  1. Replace 3.2 with 4.0 in the line pip install "Django~=3.2".
  2. Replace url with re_path in example/urls.py and change the import line to from django.urls import re_path.
  3. Go to the admin interface and add a Person.

The Title, Skills and Hobbies fields are normal text input widgets instead of the Javascript dropdown with autocomplete feature. See the screenshot below:
2022-06-24-092618_1904x1017_scrot

Package versions:

Django          4.0.5
django-tagulous 1.3.3
@jedie
Copy link
Contributor

jedie commented Jun 28, 2022

I can confirm this. Seems that the static files like 'tagulous/tagulous.js' are not in HTML.

The Problem is in tagulous.forms.AdminTagWidget.media and accessing AutocompleteMixin.media
Sadly: errors in media property are silent! Seems that the existing tests doesn't cover this.

EDIT: I now see that a PR already exists: #158

EDIT2: The bad thing is: tagulous.forms.AdminTagWidget.media raised an (silent) error and this avoids loading all Media collections from other parts!

jedie pushed a commit to jedie/django-tagulous that referenced this issue Jun 29, 2022
In Django 4.0 the `AutocompleteMixin` has been changed and the old
`AutocompleteMixin.media.fget(None)` will raise an (silent) error.

Fix this and add a test to check the included JS files.

Normally, the whole thing should be tested via browser.
But hopefully this way an error will be noticed faster.
jedie pushed a commit to jedie/django-tagulous that referenced this issue Jun 29, 2022
In Django 4.0 the `AutocompleteMixin` has been changed and the old
`AutocompleteMixin.media.fget(None)` will raise an (silent) error.

Fix this and add a test to check the included JS files.

Normally, the whole thing should be tested via browser.
But hopefully this way an error will be noticed faster.
@flbraun
Copy link

flbraun commented Jul 19, 2022

@radiac Could you please take a look at this issue and the provided PRs? We have to add a lot of unstable workaround code to circumvent this issue, which is not a nice experience.

fleur added a commit to fleur/django-tagulous that referenced this issue Oct 14, 2022
Bugfix radiac#164 Broken admin with Django 4.0
fingers crossed
@jedie
Copy link
Contributor

jedie commented Dec 22, 2022

@radiac The fix was merged, but there is no new release made since the merge, isn't it? Can you please create a new release?

EDIT: Oh #167 is still not merged :(

jedie added a commit to jedie/PyInventory that referenced this issue Dec 22, 2022
Add a work-a-round for: radiac/django-tagulous#164

The old tagulous implementation raised a silent error with Django >=4.0

The real fix is here: radiac/django-tagulous#167
kevcampb added a commit to diffractive/django-tagulous that referenced this issue Sep 8, 2023
Bugfix radiac#164 Broken admin with Django 4.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants