Skip to content
This repository was archived by the owner on Aug 20, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion django_admin_keyboard_shortcuts/static/admin/js/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ function isFocusedTextField() {
{
let previousKey = undefined;
const shortcutFunctions = new Map([
["g i", () => { document.location.href = "/admin/"; }],
["g i", () => {
const adminIndexUrl = JSON.parse(document.getElementById('admin-index-url').textContent);
document.location.href = adminIndexUrl;
}],
["g l", () => showDialog("model-list-dialog")]
]);

Expand Down
2 changes: 2 additions & 0 deletions django_admin_keyboard_shortcuts/templates/admin/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
{% block extrahead %}
{{ block.super }}
{% block extrahead_shortcuts %}
{% url 'admin:index' as admin_index_url %}
{{ admin_index_url|json_script:"admin-index-url" }}
<link rel="stylesheet" href="{% static "admin/css/shortcuts.css" %}">
<script src="{% static "admin/js/shortcuts.js" %}" async></script>
{% endblock %}
Expand Down