1 2 3 4 5 6 7 8 9 10 11 12 13 | <script type="text/javascript">
$(function(){
$("select+a.add-another").each(function(){
$(this).after(" <a class='changelink' href='#'></a>");
$(this).next().click(function(){
var link = ($(this).prev().attr('href')+'../'+$(this).prev().prev().attr('value'));
var win = window.open(link + '?_popup=1', link, 'height=600,width=1000,resizable=yes,scrollbars=yes');
win.focus();
return false;
});
});
});
</script>
|
More like this
- Add extra form elements in your contib admin by sergejdergatsjev 3 years, 2 months ago
- Allow editing of the selected object of the filter_vertical/filter_horizontal widget with jquery by jpic 3 years, 4 months ago
- Integrate Wymeditor with filebrowser plugin by jonasvp 3 years, 2 months ago
- Admin actions as buttons instead of a menu by andybak 1 year, 11 months ago
- Admin Hack: Quick lookup of GenericForeignKey id by ContentType by adnan 3 years, 4 months ago
Comments
Thanks! That's exactly what I was looking for...
I modified it a little so that if nothing's selected in the FK field it just opens the generic 'select object to change' popup (instead of throwing an error).
` $(function(){
`
#
With this two lines patch, Save button close the window.
#
Two little changes: added a title attribute to the edit icon and a simple if that prevents opening a new window in case nothing is selected:
#
Probably a noob problem, but the snippet has no effect for me with Django 1.3. The script shows up in the head section, and I've added the jquery line, but no markup is added after the add-another links. Any ideas?
#
Scratch my comment, I had the wrong path to my jquery.js. Snippet works great under 1.3.
#