Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#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)

patch.diff (1.9 KB ) - added by Nowell Strite 15 years ago.
This file fixes the problem in IE and does not break existing functionality
bug.html (301 bytes ) - added by Nowell Strite 15 years ago.
This page will demonstrate the problem if you open it in IE7 (haven't tried older versions)
models.py (613 bytes ) - added by Nowell Strite 15 years ago.
this models.py file will recreate the IE popup issue in the django admin.

Download all attachments as: .zip

Change History (14)

by Nowell Strite, 15 years ago

Attachment: patch.diff added

This file fixes the problem in IE and does not break existing functionality

by Nowell Strite, 15 years ago

Attachment: bug.html added

This page will demonstrate the problem if you open it in IE7 (haven't tried older versions)

comment:1 by Nowell Strite, 15 years ago

Cc: nowellpublic@… added

comment:2 by Ramiro Morales, 15 years ago

Possibly a duplicate of #9332

comment:3 by Nowell Strite, 15 years ago

milestone: post-1.0
Version: 1.01.0-beta-1

comment:4 by Nowell Strite, 15 years ago

This ticket details the source of the problem listed in #9332 as well as #9543, however, this one displays the root cause as well as a fully functional fix (replacing both "." and "-" with a unique reversible string, as opposed to just ".", IE6 and IE7 choke on "-" in window names).

comment:5 by Karen Tracey, 15 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.

comment:6 by Nowell Strite, 15 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 Nowell Strite, 15 years ago

Attachment: models.py added

this models.py file will recreate the IE popup issue in the django admin.

comment:7 by Ramiro Morales, 15 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.

in reply to:  6 comment:8 by Karen Tracey, 15 years ago

Resolution: duplicate
Status: newclosed

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).)

comment:9 by Nowell Strite, 15 years ago

Cc: nowellpublic@… removed

Good catch kmtracey! I will post the updated patch on #106. I will also work on being more specific with my bug reports.

in reply to:  9 comment:10 by Karen Tracey, 15 years ago

Replying to nbstrite:

Good catch kmtracey! I will post the updated patch on #106. I will also work on being more specific with my bug reports.

Don't worry about a new patch -- I can fix it up myself.

comment:11 by (none), 15 years ago

milestone: post-1.0

Milestone post-1.0 deleted

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