"Save and Continue" keyboard command for admin, with autoscroll

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
In a change_form template, such as templates/admin/myapp/change_form.html:

{% extends "admin/change_form.html" %}

{% block extrahead %}
	{{ block.super }}
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
    <script src="{{MEDIA_URL}}js/jquery.cookie.js" type="text/javascript"></script>
    <script src="{{MEDIA_URL}}js/shortcut.js" type="text/javascript"></script>
    <script type="text/javascript">
		$(function(){
			setTimeout(function(){
					$(window).scrollTop($.cookie('django_admin_scroll'));
					$.cookie('django_admin_scroll', 0);
				}, 100);
		});
		function save_and_continue(){
			$.cookie('django_admin_scroll',$(window).scrollTop());
			$('input[name="_continue"]').click()
		}
		shortcut.add("Meta+S", save_and_continue);
		shortcut.add("Ctrl+S", save_and_continue);
    </script>
{% endblock %}

More like this

  1. jQuery Double Click Edit ManyToMany in Admin by justhamade 3 years, 4 months ago
  2. remove the annoying "Hold down control..." messages by arthur 2 years, 2 months ago
  3. Admin Input Field Character Count via jQuery by joshman 4 years, 6 months ago
  4. Drag and drop ordering of admin list elements using jQuery UI by johj 3 years ago
  5. Clear FileField/ImageField files in the Admin by marinho 3 years, 11 months ago

Comments

(Forgotten your password?)