Opened 5 years ago

Last modified 2 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

Description

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.

Dave

Change History (8)

comment:1 Changed 4 years ago by julien

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Design 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 4 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 4 years ago by graham_king

  • Severity set to Normal
  • Type set to New feature

comment:4 Changed 4 years ago by julien

  • UI/UX set

comment:5 Changed 3 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:6 Changed 3 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:7 Changed 3 years ago by aaugustin

  • UI/UX set

Revert accidental batch modification.

comment:8 Changed 2 years ago by aaugustin

  • Triage Stage changed from Design decision needed to Accepted
Note: See TracTickets for help on using tickets.
Back to Top