Skip to content
Newer
Older
100644 34 lines (25 sloc) 1.25 KB
abde6f3 Update README.md
Greg V authored May 5, 2012
1 # Django mode for Emacs
85f8a9f @myfreeweb readme
authored Dec 3, 2011
2
3 ## How to install
4
5 1. Install [yasnippet](http://code.google.com/p/yasnippet/)
6 2. Add something like this to your Emacs config:
abde6f3 Update README.md
Greg V authored May 5, 2012
7
85f8a9f @myfreeweb readme
authored Dec 3, 2011
8 ```elisp
9 (require 'django-html-mode)
10 (require 'django-mode)
11 (yas/load-directory "path-to/django-mode/snippets")
abde6f3 Update README.md
Greg V authored May 5, 2012
12 (add-to-list 'auto-mode-alist '("\\.djhtml$" . django-html-mode))
13 ```
85f8a9f @myfreeweb readme
authored Dec 3, 2011
14
15 ## Jumping
16 Move your cursor to a line that contains the thing you want to go and press `C-x j`.
17 Django-mode supports jumping to:
18
19 - templates, eg. `render_to_response('some.html')` will open some.html. (it supports `@render_to` from [annoying](http://bitbucket.org/offline/django-annoying), classic `render_to_response` and the new 1.3 `TemplateResponse`)
20 - 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!)
21 - models, from `Model.objects.*` or `Model(*)`, no support for `get_object_or_404(Model*` yet
22
23 ## Inserting translation marks
24 Select a string you want to translate and press `C-t`. This works in both Python and templates.
25
26 ## Running management commands
27 Check out the Django menu :)
28 BTW, default keybindings:
29
30 - `C-c t` runs tests
31 - `C-c s` runs syncdb
32 - `C-c a` creates an app (asking for a name first)
33 - `C-c m` asks you for a command to run
Something went wrong with that request. Please try again.