Login

jQuery Double Click Edit ManyToMany in Admin

Author:
justhamade
Posted:
January 22, 2010
Language:
JavaScript
Version:
Not specified
Score:
0 (after 0 ratings)

Put this in your templates/admin/change_form.html template and you will be able to double click a manytomany in a multi select to be able to edit it.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
{% extends "admin/change_form.html" %}
{% load i18n admin_modify adminmedia %}

{% block extrahead %}
{{ block.super }}
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>

<script type="text/javascript">
$(function() {
	$('select').bind("dblclick", function(){
		var popup_url = $(this).next().attr('href').replace('add',$(this).val());
		window.open(popup_url+'?_popup=1','WINDOW_NAME','height=500,width=800,resizable=yes,scrollbars=yes')
	});
});
<script>
{% endblock %}

More like this

  1. Django Collapsed Stacked Inlines by applecat 1 year, 9 months ago
  2. Django Collapsed Stacked Inlines by mkarajohn 3 years, 10 months ago
  3. Dynamically adding forms to a formset. OOP version. by halfnibble 9 years, 6 months ago
  4. Convert multiple select for m2m to multiple checkboxes in django admin form by abidibo 11 years, 7 months ago
  5. Django admin inline ordering - javascript only implementation by ojhilt 11 years, 11 months ago

Comments

Please login first before commenting.