I'm using Django 1.1.1 and have accomplished this using jQuery.
Here's a simplified version of what I write to override the admin
change_form template for the targeted app.  I put this at /<project-
root>/templates/admin/<app_label>/<object_name>/change_form.html:

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

{% block extrahead %}{{ block.super }}
<script type="text/javascript">
$(document).ready(function(){

// Hide Inline models to reduce page size
$(".inline-group .inline-related").hide();

// Add show/hide states for inline models
$(".inline-group h2").append(" <span class='show'>(<a
href='show'>show</a>)</span> <span class='hide'
style='display:none;'>(<a href='hide'>hide</a>)</span>");
{% endblock %}

That collapses all inline formsets and then gives me a show/hide link
beside the .inline-group h2 that I can use as triggers for other
actions in jQuery.  More on overriding admin templates at
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates.

Cheers!
Josh (cabedge.com)



On Mar 1, 7:01 am, Simon Davies <simon...@gmail.com> wrote:
> Is there a way to collapse the stacked inline form-sets in the admin
> app, a parameter I can define in admin.py for inline class.  Ideally
> this would work so I could have extra=1, which would give me the
> functionality of clicking to open the form to add another object.
>
> Thanks
>
> Simon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to