- Install yasnippet
- Add something like this to your Emacs config:
(require 'django-html-mode)
(require 'django-mode)
(yas/load-directory "path-to/django-mode/snippets")
(add-to-list 'auto-mode-alist '("\\.djhtml$" . django-html-mode))
Move your cursor to a line that contains the thing you want to go and press C-x j
.
Django-mode supports jumping to:
- templates, eg.
render_to_response('some.html')
will open some.html. (it supports@render_to
from annoying, classicrender_to_response
and the new 1.3TemplateResponse
) - views (from urls.py), urls.py and views.py must be in the same directory (no global urls.py for all apps, it's a bad practice after all!)
- models, from
Model.objects.*
orModel(*)
, no support forget_object_or_404(Model*
yet
Select a string you want to translate and press C-t
. This works in both Python and templates.
Check out the Django menu :) BTW, default keybindings:
C-c t
runs testsC-c s
runs syncdbC-c a
creates an app (asking for a name first)C-c m
asks you for a command to run