Skip to content

khanxmetu/django-admin-keyboard-shortcuts

 
 

Repository files navigation

Django Admin Keyboard Shortcuts

This is a proof of concept for adding keyboard shortcuts to the Django Admin.

There is no PyPI package and I strongly recommend against using this package as it's very hacky and really just a proof of concept of the types of shortcuts we could have in the core admin. Most of the work needs to happen in core because we'd likely need to add new blocks to the admin template, and would ideally need changes to the templates.

Setup

You will need a Django project with the admin enabled. The easiest way is to use https://github.com/knyghty/django-admin-demo

Then clone this repo somewhere and install it in editable mode with pip, e.g.

pip install -e ../django-admin-keyboard-shortcuts

Then add django_admin_keyboard_shortcuts to your INSTALLED_APPS. It must go above the django.contrib.admin app so that the template overrides work.

Now you can hack away.

Supported Shortcuts

Description Shortcut Scope Status
Show help dialog ? Global Done
Go to the site index g i Global Done
Go to a change list page g l Global Done
Go to the model instance page g c Global PR#49
Select previous row for action k Change List Done
Select next row for action j Change List Done
Toggle row selection x Change List Done
Focus actions dropdown a Change List Done
Save and go to change list Alt+s Change Form Done
Save and add another Alt+a Change Form Done
Save and continue editing Alt+c Change Form Done
Delete Alt+d Change Form Done
Confirm deletion Alt+y Delete Confirmation Done
Cancel deletion Alt+n Delete Confirmation Done

Linting

This project uses ESLint as its JS linter and uses the same configuration as the Django repository. To run it, you'll first need to install dependencies

npm install

and then run

npm run lint

Credits

This package was created with Cookiecutter and the knyghty/cookiecutter-django-package project template.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 52.7%
  • HTML 34.3%
  • Python 6.9%
  • CSS 6.1%