Opened 6 years ago

Last modified 4 years ago

#13917 new New feature

Multiple popup window feature of related objects popup through id_to_windowname

Reported by: davidcooper Owned by: nobody
Component: contrib.admin Version: 1.2
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: yes


In an app that has a cascading set of objects we required the ability to have multiple popup windows. In tabbed browsers this can work out well, especially when the tabs can cascade like the firefox tree-style view. To bring this support to django all that is required is an override for the two methods id_to_windowname and windowname_to_id at line 18 of django/contrib/admin/media/js/admin/RelatedObjectLookups.js, such as this:

var uniqueness=(new Date()).valueOf();

function id_to_windowname(text) {
    text = text.replace(/\./g, '__dot__');
    text = text.replace(/\-/g, '__dash__');
    return uniqueness + text;

function windowname_to_id(text) {
    text = text.replace(uniqueness, '');
    text = text.replace(/__dot__/g, '.');
    text = text.replace(/__dash__/g, '-');
    return text;

This trivial change to the 'name' of the window allows multiple caller-callee connections, even involving the same models, as used as the id.


Change History (8)

comment:1 Changed 6 years ago by Julien Phalip

Needs documentation: unset
Needs tests: unset
Patch needs improvement: set
Triage Stage: UnreviewedDesign decision needed

This sounds interesting. Marking as DDN as it's unclear what the implications would be. Could you provide a more specific use case for this? Any proof that your suggested change wouldn't break any existing code would also be appreciated.

comment:2 Changed 6 years ago by davidcooper

Sorry for ignoring this. I can say that I have used it on my site for sometime now without problem. I cannot imagine how any existing service would be impacted negatively, the change is pretty trivial and is isolated.

comment:3 Changed 6 years ago by Graham King

Severity: Normal
Type: New feature

comment:4 Changed 5 years ago by Julien Phalip

UI/UX: set

comment:5 Changed 5 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:6 Changed 5 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:7 Changed 5 years ago by Aymeric Augustin

UI/UX: set

Revert accidental batch modification.

comment:8 Changed 4 years ago by Aymeric Augustin

Triage Stage: Design decision neededAccepted
Note: See TracTickets for help on using tickets.
Back to Top