Skip to main content

Keyboard shortcuts for Django Admin

Project description

django-admin-keyshortcuts

A Django package that adds keyboard shortcuts to the Django Admin interface for improved accessibility.

Demo

A static preview of Django Admin with Keyboard Shortcuts is available at:
https://khanxmetu.github.io/django-admin-keyshortcuts-demo/

Setup

Install from pip:
pip install django-admin-keyshortcuts

then add django_admin_keyshortctus before django.contrib.admin in your INSTALLED_APPS:

INSTALLED_APPS = (
    ...,
    'django_admin_keyshortcuts',
    'django.contrib.admin', 
    ...,
)

Usage

The following is a list of supported shortcuts

Description Shortcut (Windows/Linux) Shortcut (MacOS) Scope
Show shortcuts help dialog ? ? Global
Go to the site index g i g i Global
Toggle sidebar [ [ Global (where it exists)
Select previous row for action k k Change List
Select next row for action j j Change List
Toggle row selection x x Change List
Focus actions dropdown a a Change List
Focus search field / / Change List
Save and go to change list Ctrl+s ⌘+s Change Form
Save and add another Ctrl+Shift+S ⌘+Shift+S Change Form
Save and continue editing Ctrl+Alt+s ⌘+⌥+s Change Form
Delete Alt+d ⌥+d Change Form
Confirm deletion Alt+y ⌥+y Delete Confirmation
Cancel deletion Alt+n ⌥+n Delete Confirmation

Adding Custom Shortcuts

This package uses the GitHub Hotkey library for handling shortcuts. You can add new ones by extending templates:

  1. In the admin template, locate the element you want triggered by the shortcut.
  2. Extend the template and add data-hotkey attribute to the target element, e.g. data-hotkey="Mod+s". See hotkey string format for supported modifier and key combinations.
  3. Document the shortcut in the help dialog.

View-specific (per page) shortcuts: Extend change_list_shortcuts, change_form_shortcuts, or delete_confirmation_shortcuts.
Example:

{% extends "admin/change_list_shortcuts.html" %}
{% load shortcuts %}
{% block extra_shortcuts %}
{{ block.super }}
  <section>
    <h3>Custom Shortcuts</h3>
    <dl>
        <dt class="shortcut-description">A Custom Shortcut</dt>
        <dd class="shortcut-keys">{% shortcut_format_kbd "Mod+s" %}</dd>
    </dl>
</section>
{% endblock %}

Global shortcuts:
Example:

{% extends "admin/shortcuts.html" %}
{% load shortcuts %}
{% block global_shortcuts %}
  {{ block.super }}
  <section>
    <h3>Custom Shortcuts</h3>
    <dl>
      <dt class="shortcut-description">A Custom Shortcut</dt>
      <dd class="shortcut-keys">{% shortcut_format_kbd "Mod+S" %}</dd>
    </dl>
  </section>
{% endblock %}

Tip: Use the Mod key (⌘ on macOS, Ctrl on Windows/Linux). It ensures shortcuts are OS-independent and automatically map to the correct key per platform.

About

The django-admin-keyshortcuts package is being developed with the goal of eventually merging its functionality into Django core.
This package has been undergoing refinements with respect to GSoC 2025: Keyboard Shortcuts Specification

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_admin_keyshortcuts-0.2.1.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_admin_keyshortcuts-0.2.1-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file django_admin_keyshortcuts-0.2.1.tar.gz.

File metadata

File hashes

Hashes for django_admin_keyshortcuts-0.2.1.tar.gz
Algorithm Hash digest
SHA256 cd0bbe5541f370fd43b70414166893e738a0b920010574135c94a5315ed0cfd8
MD5 052e9bb1c4bffe951d15f73ae8a1f89c
BLAKE2b-256 a8ec99da16ff7d40f9684d049be7af1dd81cac7d50971fd7e6d62f38c4d88f60

See more details on using hashes here.

File details

Details for the file django_admin_keyshortcuts-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_admin_keyshortcuts-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 df18921d8dd3c407a6bc1ca97df5324fc551bddb2ced47f94e0e1ca66dcdae80
MD5 747447a9d529bb7d933ecb2cc5ff1abc
BLAKE2b-256 c45bc1327841a5027595f61e26edda40e85a9c34f54e6d74a99ae58772fa4fe8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page