From 979c8c5c73ed6f65e30f61903857b7955d0b2082 Mon Sep 17 00:00:00 2001 From: Fabio Caccamo Date: Wed, 14 Feb 2024 18:33:32 +0100 Subject: [PATCH] Add FAQ for opening any url in modal window. --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index e07d014..822ad0f 100644 --- a/README.md +++ b/README.md @@ -253,6 +253,15 @@ urlpatterns = [ urlpatterns += i18n_patterns(path("admin/", admin.site.urls)) ``` +### Open any url in modal window +> I have an application with some cross-links in the admin and I would like to open them in modal windows instead of same/new window, how can I do? + +You just need to add `_popup=1` query-string parameter to the urls: +```python +url = reverse(f"admin:myapp_mymodel_change", args=[mymodel_instance.pk]) +url = f"{url}?_popup=1" +``` + ## Testing ```bash # clone repository