1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | {% block extrahead %}
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
//<![CDATA[
jQuery(function($) {
// Make hyperlinks for labels of raw_id_fields
$('a.related-lookup').each(function() {
var td = $(this).parent();
var id = $('input', td).val();
var url = $(this).attr('href').split('?')[0] + id + '/';
$('strong', td).wrap('<a href="' + url + '"></a>');
});
});
//]]>
</script>
{% endblock %}
|
More like this
- Unobtrusvie Foldable Admin Interface by whiteinge 5 years, 4 months ago
- FCKEditor replace all vLargeTextField in admin by aronchi 4 years, 7 months ago
- Admin Input Field Character Count via jQuery by joshman 4 years, 5 months ago
- Link raw_id_fields (both ForeignKeys and ManyToManyFields) to their change pages by EmilStenstrom 2 years, 7 months ago
- Confirm alert if the user navigates away without saving changes by mrazzari 3 years, 10 months ago
Comments
I think it is even better to put this into admin/change_form.html instead of admin/base_site.html
Also, you can combine this with this http://djangosnippets.org/snippets/1376/ snippet and add {% extends "admin:admin/change_form.html" %} on top of your change_form.html. That way you don't need to copy the whole file from the admin app.
#