Index: django/django/forms/formsets.py
===================================================================
--- django/django/forms/formsets.py	(revision 12351)
+++ django/django/forms/formsets.py	(working copy)
@@ -318,9 +318,9 @@
         return mark_safe(u'\n'.join([unicode(self.management_form), forms]))
 
 def formset_factory(form, formset=BaseFormSet, extra=1, can_order=False,
-                    can_delete=False, max_num=0):
+                    can_delete=False, max_num=0, classes=[]):
     """Return a FormSet for the given form class."""
-    attrs = {'form': form, 'extra': extra,
+    attrs = {'form': form, 'extra': extra, 'classes': classes,
              'can_order': can_order, 'can_delete': can_delete,
              'max_num': max_num}
     return type(form.__name__ + 'FormSet', (formset,), attrs)
Index: django/django/forms/models.py
===================================================================
--- django/django/forms/models.py	(revision 12351)
+++ django/django/forms/models.py	(working copy)
@@ -635,7 +635,7 @@
         super(BaseModelFormSet, self).add_fields(form, index)
 
 def modelformset_factory(model, form=ModelForm, formfield_callback=lambda f: f.formfield(),
-                         formset=BaseModelFormSet,
+                         formset=BaseModelFormSet, classes=[],
                          extra=1, can_delete=False, can_order=False,
                          max_num=0, fields=None, exclude=None):
     """
@@ -644,7 +644,8 @@
     form = modelform_factory(model, form=form, fields=fields, exclude=exclude,
                              formfield_callback=formfield_callback)
     FormSet = formset_factory(form, formset, extra=extra, max_num=max_num,
-                              can_order=can_order, can_delete=can_delete)
+                              can_order=can_order, can_delete=can_delete,
+                              classes=classes)
     FormSet.model = model
     return FormSet
 
@@ -776,7 +777,7 @@
 
 def inlineformset_factory(parent_model, model, form=ModelForm,
                           formset=BaseInlineFormSet, fk_name=None,
-                          fields=None, exclude=None,
+                          fields=None, exclude=None, classes=[],
                           extra=3, can_order=False, can_delete=True, max_num=0,
                           formfield_callback=lambda f: f.formfield()):
     """
@@ -799,6 +800,7 @@
         'fields': fields,
         'exclude': exclude,
         'max_num': max_num,
+        'classes': classes,
     }
     FormSet = modelformset_factory(model, **kwargs)
     FormSet.fk = fk
Index: django/django/contrib/admin/options.py
===================================================================
--- django/django/contrib/admin/options.py	(revision 12351)
+++ django/django/contrib/admin/options.py	(working copy)
@@ -1180,6 +1180,7 @@
     template = None
     verbose_name = None
     verbose_name_plural = None
+    classes = []
 
     def __init__(self, parent_model, admin_site):
         self.admin_site = admin_site
@@ -1196,6 +1197,8 @@
         js = ['js/jquery.min.js', 'js/inlines.min.js']
         if self.prepopulated_fields:
             js.append('js/urlify.js')
+        if 'collapse' in self.classes:
+            js.append('js/collapse.min.js')
         if self.filter_vertical or self.filter_horizontal:
             js.extend(['js/SelectBox.js' , 'js/SelectFilter2.js'])
         return forms.Media(js=['%s%s' % (settings.ADMIN_MEDIA_PREFIX, url) for url in js])
@@ -1225,6 +1228,7 @@
             "formfield_callback": curry(self.formfield_for_dbfield, request=request),
             "extra": self.extra,
             "max_num": self.max_num,
+            "classes": self.classes,
         }
         defaults.update(kwargs)
         return inlineformset_factory(self.parent_model, self.model, **defaults)
Index: django/django/contrib/admin/templates/admin/edit_inline/tabular.html
===================================================================
--- django/django/contrib/admin/templates/admin/edit_inline/tabular.html	(revision 12351)
+++ django/django/contrib/admin/templates/admin/edit_inline/tabular.html	(working copy)
@@ -2,7 +2,7 @@
 <div class="inline-group" id="{{ inline_admin_formset.formset.prefix }}-group">
   <div class="tabular inline-related {% if forloop.last %}last-related{% endif %}">
 {{ inline_admin_formset.formset.management_form }}
-<fieldset class="module">
+<fieldset class="module{% for class in inline_admin_formset.formset.classes %} {{class}}{% endfor %}">
    <h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2>
    {{ inline_admin_formset.formset.non_form_errors }}
    <table>
Index: django/django/contrib/contenttypes/generic.py
===================================================================
--- django/django/contrib/contenttypes/generic.py	(revision 12351)
+++ django/django/contrib/contenttypes/generic.py	(working copy)
@@ -337,7 +337,7 @@
 def generic_inlineformset_factory(model, form=ModelForm,
                                   formset=BaseGenericInlineFormSet,
                                   ct_field="content_type", fk_field="object_id",
-                                  fields=None, exclude=None,
+                                  fields=None, exclude=None, classes=[],
                                   extra=3, can_order=False, can_delete=True,
                                   max_num=0,
                                   formfield_callback=lambda f: f.formfield()):
@@ -362,7 +362,7 @@
         exclude = [ct_field.name, fk_field.name]
     FormSet = modelformset_factory(model, form=form,
                                    formfield_callback=formfield_callback,
-                                   formset=formset,
+                                   formset=formset, classes=classes,
                                    extra=extra, can_delete=can_delete, can_order=can_order,
                                    fields=fields, exclude=exclude, max_num=max_num)
     FormSet.ct_field = ct_field
@@ -390,7 +390,8 @@
             "can_order": False,
             "fields": fields,
             "max_num": self.max_num,
-            "exclude": self.exclude
+            "exclude": self.exclude,
+            "classes": self.classes,
         }
         return generic_inlineformset_factory(self.model, **defaults)
 
Index: django/docs/ref/contrib/admin/index.txt
===================================================================
--- django/docs/ref/contrib/admin/index.txt	(revision 12351)
+++ django/docs/ref/contrib/admin/index.txt	(working copy)
@@ -1077,6 +1077,21 @@
 An override to the ``verbose_name_plural`` found in the model's inner ``Meta``
 class.
 
+``classes``
+~~~~~~~~~~~
+
+.. versionadded:: development
+
+A list containing extra CSS classes to apply to the inline.
+
+Example::
+
+    class BookInline(admin.TabularInline):
+        classes = ['collapse', 'extrapretty']
+
+A useful class is ``collapse``, which will cause the inline to be initially
+collapsed.
+
 Working with a model with two or more foreign keys to the same parent model
 ---------------------------------------------------------------------------
 
