Opened 19 years ago
Closed 17 years ago
#348 closed defect (fixed)
[patch] Multiple clicks on "Choose all" or "Clear all" in the Javascript "filter" interface causes strange behavior
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | contrib.admin | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
I'm writing a simple contact-tracking application in Django. I have Person, Address, and Newsletter models. Newsletter is a many-to-many relation to Person, so that I can ask "Who got the June 2005 newsletter?" and "How many newsletters has John Smith missed?". I used the filter_interface
option to tie Newsletter to Person in the admin interface. I then set up some test data to play around with the filter_interface
, including three Persons: John Smith, Linda Jones, and Sophie Sophist (who lives at 123 Philosopher Lane, naturally).
Selecting individual people and clicking the left and right arrows moved names around just fine. No problems there. And single-clicking on the "Clear all" and "Choose all" worked as expected. Double-clicking on either "Clear all" or "Choose all", though, produced some weird results: all the names would move across, but then when moved back, a single name would get left behind. E.g.:
- "Available persons" contains all three names.
- Click on "Choose all". All three names move to "Chosen persons".
- Click on "Choose all" a second time. No visible result.
- Click on "Clear all". All three names move to "Available persons", but a second copy of Linda Jones is left behind.
- Click on "Choose all". All three names from "Available persons" move over to "Chosen persons", and there are now four names (including two Linda Jones entries) in "Chosen persons".
Repeating such a procedure ends up yielding five names, then six, then seven, out of the original three. All of them act like real entries: I can select them one at a time and move them left or right, and they don't disappear.
Furthermore, if I click three or four or five times on "Choose all" before clicking on "Clear all", then two or three or four names get left behind when I finally do click "Clear all".
This also works in reverse, e.g. if I click "Clear all" multiple times and then click "Choose all", it will also leave some names behind.
If I leave one side or the other ("Chosen persons" or "Available persons") empty, the correct values seem to go into the database: it only creates one row in the multiple-join table even though there are ten copies of Linda Jones present in "Chosen persons", for example. But if a name is present in both "Chosen persons" and "Available persons", "Chosen" wins. A single copy of John Smith in "Chosen persons" trumps a dozen John Smiths in "Available persons".
I can reproduce this bug consistently using Firefox 1.0.6 on Ubuntu Breezy, and Firefox 1.0.6 on Mac OS X 10.3.9.
Attachments (1)
Change History (6)
by , 18 years ago
comment:1 by , 18 years ago
Summary: | Multiple clicks on "Choose all" or "Clear all" in the Javascript "filter" interface causes strange behavior → [patch] Multiple clicks on "Choose all" or "Clear all" in the Javascript "filter" interface causes strange behavior |
---|
follow-up: 4 comment:3 by , 18 years ago
comment:4 by , 18 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
Replying to Marc Fargas <telenieko@telenieko.com>:
The references #3099 is markes as duplicate of #3202. Can somebody confirm if the patch in there would solve this ticket? Or if the bug is still reproducible (it's 1 year old).
This bug is still reproducible, please see this comment I made in #3202.
comment:5 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Didn't look to see if anything was going on with SelectBox.cache, but doing the
cache_contains()
check inmove_all()
, whichmove()
was doing, seems to make things better.