#9539 closed (duplicate)
Admin raw_id_fields search popup breaks in IE7 with "-" in field name.
Reported by: | Nowell Strite | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 1.0-beta |
Severity: | Keywords: | javascript | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I am running IE7 on Vista and on XP and have experienced a bug where the raw_id_fields window will not popup properly due to IE not accepting dash's or dots in its popup window names. There is already code in the javascript to remove "." from the window name, but we also need to replace "-". For example try to run this JS in IE.
<html> <head> </head> <body> <h1>IE Window Popup bug</h1> <a href="javascript:window.open('http://www.djangoproject.com', 'window___dash__name')">Working Window Popup</a> | <a href="javascript:window.open('http://www.djangoproject.com', 'window-name')">Broken Window Popup</a> </body> </html>
Attachments (3)
Change History (14)
by , 16 years ago
Attachment: | patch.diff added |
---|
by , 16 years ago
This page will demonstrate the problem if you open it in IE7 (haven't tried older versions)
comment:1 by , 16 years ago
Cc: | added |
---|
comment:3 by , 16 years ago
milestone: | → post-1.0 |
---|---|
Version: | 1.0 → 1.0-beta-1 |
comment:4 by , 16 years ago
comment:5 by , 16 years ago
What none of them contain is a specific description of how to recreate the problem. I noted in #9332 that raw_id_admin popups work for me on these IE broswers (and I just verified that again), so there's something that triggers this that isn't present in my setup. It would help if someone posted detailed specifics on how to recreate the error -- minimal but complete !Model and ModelAdmin definitions, e.g. I'd like to fix this but I'm not going to check in a code change I cannot verify works to fix a problem, particularly when it's not something easily tested by the test suite.
follow-up: 8 comment:6 by , 16 years ago
Hey, I attached an html document that demonstrates the bug in IE, however, to see the bug within the django admin just setup and application with the attached models.py file, or copy from below, and then try to click on the magnifying glass next to the Child lookup (in IE of course). Instead of popping up a new window, it will replace the existing window. Apply the attached patch, and all will be right with the world:
from django.db import models from django.contrib import admin class Person(models.Model): name = models.CharField(max_length=10) class Relationship(models.Model): parent = models.ForeignKey(Person, related_name='parents') child = models.ForeignKey(Person, related_name='children') class RelationshipInline(admin.TabularInline): model = Relationship fk_name = 'parent' raw_id_fields = ['child'] class PersonAdmin(admin.ModelAdmin): fields = ['name'] inlines = [RelationshipInline] admin.site.register(Person, PersonAdmin) admin.site.register(Relationship)
by , 16 years ago
this models.py file will recreate the IE popup issue in the django admin.
comment:7 by , 16 years ago
I could reproduce the problem (when adding a new Person
clicking on the magnifying glass next to one of the Child lookups, instead of popping up a new window, replaces the existing window) with the above provided models.py
on IE7 7.0.5730.13
+ Win XP SP2. Django revision is trunk as of r9390.
comment:8 by , 16 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Replying to nbstrite:
Hey, I attached an html document that demonstrates the bug in IE
Yes, but that didn't show me how it was that the admin was generating window names unacceptable to IE, which (call me a stickler but there it is) I really wanted to understand before checking in any kind of code change. The key is the inlines, which was only mentioned in one of the three recent tickets that reported this, and not in a way that made it clear that that was the key to causing the problem.
As it turns out the problem with dashes was the reason #106 was reopened, so I'll fix it under that number. (BTW, also I don't think the patch here is correct since it appears the restoration of dashes is going to clobber what was done to restore the dots (though I'm not even sure the dots are ever used anymore in Window names).)
follow-up: 10 comment:9 by , 16 years ago
Cc: | removed |
---|
Good catch kmtracey! I will post the updated patch on #106. I will also work on being more specific with my bug reports.
This file fixes the problem in IE and does not break existing functionality