Opened 5 years ago

Closed 3 years ago

#22955 closed Bug (fixed)

Admin: reloading clears filter_horizontal entries on Firefox

Reported by: anonymous Owned by: elky
Component: contrib.admin Version: 1.6
Severity: Normal Keywords: admin filter_horizontal reload
Cc: cmawebsite@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

In an admin page with a filter_horizontal, loading a page normally will load and save the entries of a filter_horizontal properly, but if you reload the filter_horizontal will be emptied, and if that page is saved those entries will be lost.

Reproduced with: Django 1.4.9, 1.6.2 and 1.6.5

Change History (15)

comment:1 Changed 5 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

I can reproduce with Firefox 30, but not Chrome 35. Which browser are you using? Tentatively accepting, but it may be a browser bug and not something we can/should fix in Django.

comment:2 Changed 5 years ago by Tim Graham

Resolution: duplicate
Status: newclosed

Actually this has been reported in #13614.

comment:3 Changed 4 years ago by Ben Kornrath

I think #13614 is actually a separate issue (although it seems there has been some discussion about this issue on #13614). The test html in comment 16 (https://code.djangoproject.com/ticket/13614#comment:16) seems to be working on Firfox 36.

I can confirm that this is still problem on Firefox 36 with Django 1.6.10, 1.7.5, 1.8b1. How can I reopen this bug?

comment:4 Changed 4 years ago by Ben Kornrath

Resolution: duplicate
Status: closednew

comment:5 Changed 4 years ago by Ben Kornrath

This pull request adds a failing test case to demonstrate the problem.

https://github.com/django/django/pull/4277

I'm not exactly sure what the way forward is for this issue. There seems to be a couple tickets that have full rewrite of the select filter js code. My primary interest is ensuring that any re-write of the select filter js code incorporates this test so that this problem gets fixed.

comment:6 Changed 4 years ago by Collin Anderson

Cc: cmawebsite@… added

comment:7 Changed 4 years ago by Tim Graham

Summary: Admin: reloading clears filter_horizontal entriesAdmin: reloading clears filter_horizontal entries on Firefox

I tested on Internet Explorer 9 and there's no problem there either. To me, this still seems like an issue that would be better addressed in Firefox itself so older versions of Django can benefit from the fix as well.

comment:8 Changed 4 years ago by elky

Owner: changed from nobody to elky
Status: newassigned

comment:9 Changed 4 years ago by elky

Just made pull request that fixes this problem: https://github.com/django/django/pull/5757

comment:10 Changed 3 years ago by Tim Graham

I couldn't reproduce this on master with Firefox 43.0 and bisected the change to 4a438e400b7ce0ab9d0b6876196cbe8d620a4171. It seems plausible this fixed the issue as the admin views are wrapped in never_cache(). Can you reproduce those findings?

comment:11 Changed 3 years ago by elky

Can't reproduce it in the latest Firefox as well. Using Django 1.9. Seems my fix works for lower Django versions only.

comment:12 Changed 3 years ago by Tim Graham

Has patch: set
Patch needs improvement: set

I think we can backport the fix for #13008 for 1.8 to fix this possible data loss issue there. Let's try to get the selenium test in your pull request working so we can add that too. Hopefully my review comments will help.

comment:13 Changed 3 years ago by Tim Graham

I backported the fix for #13008 to 1.8 in b51086d57313e7ea857f4b96b62d25e600ee0a8d so this should be resolved there.

comment:14 Changed 3 years ago by Tim Graham <timograham@…>

In 0cc32a8f:

Refs #22955 -- Added test for admin's many-to-many widget refresh data loss bug.

This was fixed by 4a438e400b7ce0ab9d0b6876196cbe8d620a4171.

comment:15 Changed 3 years ago by Tim Graham

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.
Back to Top