- January 7, 2010
- Not specified
- 2 (after 2 ratings)
This snippet is helpful if you do a lot of editing on a single large admin form (for example, in a rich text field), and want to frequently save your progress. If you press control-S, or command-S on a Mac, the admin change form will save and reload, and the page will scroll back down to where you last were.
This snippet relies on jquery, jquery.cookie, and the shortcut.js keyboard library (which doesn't use jquery, but seemed more robust than the jquery keyboard plugins I saw). It uses a temporary cookie to remember where the page was scrolled to, to avoid having to override the admin behavior.
Note: don't put this in templates/admin/change_form.html -- the circular import causes a Django crash.
Edit: Had forgotten to include jquery.cookie, which I was already including elsewhere.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
More like this
- Django Collapsed Stacked Inlines by mkarajohn 9 months, 2 weeks ago
- Dynamically adding forms to a formset. OOP version. by halfnibble 6 years, 5 months ago
- Convert multiple select for m2m to multiple checkboxes in django admin form by abidibo 8 years, 6 months ago
- Google v3 geocoding for Geodjango admin site by samhag 8 years, 11 months ago