Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Related modal window includes the header. #377

Open
fabiocaccamo opened this issue Mar 19, 2024 · 4 comments
Open

Related modal window includes the header. #377

fabiocaccamo opened this issue Mar 19, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@fabiocaccamo
Copy link
Owner

fabiocaccamo commented Mar 19, 2024

Python version
3.11

Django version
4.2.9

Package version
0.28.6

Current behavior (bug description)
When opening a custom modal window (just adding _popup=1 suffix to the url), the resulting modal window content includes the admin site header.

Expected behavior
The resulting modal window content must not include the admin site header.

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@fabiocaccamo fabiocaccamo added the bug Something isn't working label Mar 19, 2024
@fabiocaccamo fabiocaccamo self-assigned this Mar 19, 2024
@fabiocaccamo
Copy link
Owner Author

fabiocaccamo commented Mar 19, 2024

Investigating what is happening

Clicking the link, the url is loaded in the modal window:
https://mysite.com/admin/myapp/mymodel/?_popup=1&_modal=347257

It returns a 302 and then the final url becomes:
https://mysite.com/admin/myapp/mymodel/?e=1

The problem is that django, for security reasons filters out unexpected query-string parameters, and in this case the _modal parameter gets appended here just for app specific needs (only if it's not a lookup):
https://github.com/fabiocaccamo/django-admin-interface/blob/main/admin_interface/static/admin_interface/related-modal/related-modal.js#L60


This behavior, although very useful, is also very limiting in case you want to load custom pages in modal windows and use custom query-string parameters for specific needs.

@fabiocaccamo
Copy link
Owner Author

@merwok do you have any ideas on how this problem could be solved/avoided?

@merwok
Copy link
Contributor

merwok commented Mar 19, 2024

Not sure I understand the comment in related-modal.js

«Browsers stop loading nested iframes with same src» (same as origin page I suppose?) – but why would they be the same? The main page does not have ?_popup=1.

@fabiocaccamo
Copy link
Owner Author

@merwok I don't remember well the nested modals open on the same url issue.
Btw, the problem is that if there are custom query-string params it doesn't work correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

2 participants