Opened 22 months ago

Closed 21 months ago

Last modified 21 months ago

#33904 closed Bug (fixed)

Many-To-Many field is deleted/ignored from internal JavaScript “filter” interface

Reported by: Richard Saeuberlich Owned by: nobody
Component: contrib.admin Version: 4.1
Severity: Normal Keywords: javascript, admin, frontend
Cc: Carsten Fuchs Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

As the summary says. This happens if you use one of the built in Many-To-Many filters (https://docs.djangoproject.com/en/4.0/ref/contrib/admin/#django.contrib.admin.ModelAdmin.filter_horizontal). Both filters (horizontal & vertical) provoke this behavior. If you don't use any of the filters, everything works as expected. Same goes for Django version smaller than 4.1.

Therefore, I don't think this is a backend problem. I think the JavaScript wasn't updated with all necesary changes from v.4.1. Or maybe there is a problem with the template engine?!?

Finally, a minimalist project for error reproduction: https://github.com/aDramaQueen/django-many-to-many-error

Change History (6)

comment:1 by Mariusz Felisiak, 22 months ago

Resolution: fixed
Status: newclosed

Thanks for the report! It was a regression in fe7dbef5867c577995f0fc849d8dfdb8f2e6bbfa fixed in 0756c61f2ada56e4ae625589099c0141a77737eb (Django 4.1.1).

comment:2 by Carsten Fuchs, 21 months ago

Cc: Carsten Fuchs added

comment:3 by Carsten Fuchs, 21 months ago

Resolution: fixed
Status: closednew

As discussed at https://groups.google.com/g/django-developers/c/3W3eV6qyMeA/m/7_pif1UOAgAJ, the issue does not seem to be fixed: As demonstrated by the OP at https://github.com/aDramaQueen/django-many-to-many-error, new objects that use a many-to-many relationship with horizontal oder vertical filters cannot be created (error: "This field is required" even if a value is given).

comment:4 by Carlton Gibson, 21 months ago

Hmmm. I've just downloaded the project and testing on main, stable/4.1.x, the 4.1 tag, and stable/4.0.x I'm not seeing the behaviour. 🤔

Under normal circumstances I'd close as worksforme, but since you just re-opened it Carsten, presumably you are seeing it... 😬
Can you dig a little?

(Browser cache maybe? 🤔)

(I did a video but it's too big to upload to trac.)

comment:5 by Tim Graham, 21 months ago

Resolution: fixed
Status: newclosed

I also saw this issue and confirmed that it's fixed by the commit in comment 1. If you still see the problem admin/js/change_form.js may be cached by your browser.

comment:6 by Carsten Fuchs, 21 months ago

Ok, many thanks for everyone's help! Sorry for the noise!

Note: See TracTickets for help on using tickets.
Back to Top