This repository was archived by the owner on Aug 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
django_admin_keyboard_shortcuts Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,17 @@ function isFocusedTextField() {
1111{
1212 let previousKey = undefined ;
1313 const shortcutFunctions = new Map ( [
14- [ "g i" , ( ) => { document . location . href = "/admin/" ; } ] ,
14+ [ "g i" , ( ) => {
15+ // Get the admin index URL from the json_script element
16+ const adminIndexElement = document . getElementById ( 'admin-index-url' ) ;
17+ if ( adminIndexElement ) {
18+ const adminIndexUrl = JSON . parse ( adminIndexElement . textContent ) ;
19+ document . location . href = adminIndexUrl ;
20+ } else {
21+ // Fallback to default if element not found
22+ document . location . href = "/admin/" ;
23+ }
24+ } ] ,
1525 [ "g l" , ( ) => showDialog ( "model-list-dialog" ) ]
1626 ] ) ;
1727
Original file line number Diff line number Diff line change 44{% block extrahead %}
55 {{ block.super }}
66 {% block extrahead_shortcuts %}
7+ {% url 'admin:index' as admin_index_url %}
8+ {{ admin_index_url|json_script:"admin-index-url" }}
79 < link rel ="stylesheet " href ="{% static "admin /css/shortcuts.css" %}">
810 < script src ="{% static "admin /js/shortcuts.js" %}" async> </ script >
911 {% endblock %}
You can’t perform that action at this time.
0 commit comments