diff --git a/django/newforms/models.py b/django/newforms/models.py
index 5c4dc08..8401296 100644
--- a/django/newforms/models.py
+++ b/django/newforms/models.py
@@ -15,8 +15,8 @@ from widgets import Select, SelectMultiple, HiddenInput, MultipleHiddenInput
 
 __all__ = (
     'save_instance', 'form_for_model', 'form_for_instance', 'form_for_fields',
-    'ModelChoiceField', 'ModelMultipleChoiceField', 'formset_for_model',
-    'inline_formset'
+    'formset_for_model', 'formset_for_queryset', 'inline_formset',
+    'ModelChoiceField', 'ModelMultipleChoiceField',
 )
 
 def save_instance(form, instance, fields=None, fail_message='saved', commit=True):
@@ -237,17 +237,20 @@ def initial_data(instance, fields=None):
 
 class BaseModelFormSet(BaseFormSet):
     """
-    A ``FormSet`` attatched to a particular model or sequence of model instances.
+    A ``FormSet`` for editing a queryset and/or adding new objects to it.
     """
     model = None
+    queryset = None
 
-    def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, instances=None):
-        self.instances = instances
+    def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None):
         kwargs = {'data': data, 'files': files, 'auto_id': auto_id, 'prefix': prefix}
-        if instances:
-            kwargs['initial'] = [initial_data(instance) for instance in instances]
+        if self.queryset:
+            kwargs['initial'] = [initial_data(obj) for obj in self.get_queryset()]
         super(BaseModelFormSet, self).__init__(**kwargs)
 
+    def get_queryset(self):
+        return self.queryset._clone()
+
     def save_new(self, form, commit=True):
         """Saves and returns a new model instance for the given form."""
         return save_instance(form, self.model(), commit=commit)
@@ -260,25 +263,31 @@ class BaseModelFormSet(BaseFormSet):
         """Saves model instances for every form, adding and changing instances
         as necessary, and returns the list of instances.
         """
+        return self.save_existing_objects(commit) + self.save_new_objects(commit)
+
+    def save_existing_objects(self, commit=True):
+        if not self.queryset:
+            return []
+        # Put the objects from self.queryset into a dict so they are easy to lookup by pk
+        existing_objects = {}
+        for obj in self.queryset._clone():
+            existing_objects[obj._get_pk_val()] = obj
         saved_instances = []
-        # put self.instances into a dict so they are easy to lookup by pk
-        instances = {}
-        for instance in self.instances:
-            instances[instance._get_pk_val()] = instance
-        if self.instances:
-            # update/save existing instances
-            for form in self.change_forms:
-                instance = instances[form.cleaned_data[self.model._meta.pk.attname]]
-                if form.cleaned_data[DELETION_FIELD_NAME]:
-                    instance.delete()
-                else:
-                    saved_instances.append(self.save_instance(form, instance, commit=commit))
-        # create/save new instances
+        for form in self.change_forms:
+            obj = existing_objects[form.cleaned_data[self.model._meta.pk.attname]]
+            if self.deletable and form.cleaned_data[DELETION_FIELD_NAME]:
+                obj.delete()
+            else:
+                saved_instances.append(self.save_instance(form, obj, commit=commit))
+        return saved_instances
+
+    def save_new_objects(self, commit=True):
+        new_objects = []
         for form in self.add_forms:
             if form.is_empty():
                 continue
-            saved_instances.append(self.save_new(form, commit=commit))
-        return saved_instances
+            new_objects.append(self.save_new(form, commit=commit))
+        return new_objects
 
     def add_fields(self, form, index):
         """Add a hidden field for the object's primary key."""
@@ -286,50 +295,76 @@ class BaseModelFormSet(BaseFormSet):
         form.fields[self._pk_field_name] = IntegerField(required=False, widget=HiddenInput)
         super(BaseModelFormSet, self).add_fields(form, index)
 
-def formset_for_model(model, form=BaseForm, formfield_callback=lambda f: f.formfield(), formset=BaseModelFormSet, extra=1, orderable=False, deletable=False, fields=None):
-    form = form_for_model(model, form=form, fields=fields, formfield_callback=formfield_callback)
+def formset_for_queryset(queryset, form=BaseForm, formfield_callback=lambda f: f.formfield(),
+                         formset=BaseModelFormSet, extra=1, orderable=False, deletable=False, fields=None):
+    """
+    Returns a FormSet class for the given QuerySet. This FormSet will contain
+    change forms for every instance in the QuerySet as well as the number of
+    add forms specified by ``extra``.
+    
+    Provide ``extra`` to determine the number of add forms to display.
+
+    Provide ``deletable`` if you want to allow the formset to delete any
+    objects in the given queryset.
+    
+    Provide ``form`` if you want to use a custom BaseForm subclass.
+    
+    Provide ``formfield_callback`` if you want to define different logic for
+    determining the formfield for a given database field. It's a callable that
+    takes a database Field instance and returns a form Field instance.
+
+    Provide ``formset`` if you want to use a custom BaseModelFormSet subclass.
+    """
+    form = form_for_model(queryset.model, form=form, fields=fields, formfield_callback=formfield_callback)
     FormSet = formset_for_form(form, formset, extra, orderable, deletable)
-    FormSet.model = model
+    FormSet.model = queryset.model
+    FormSet.queryset = queryset
     return FormSet
 
+def formset_for_model(model, form=BaseForm, formfield_callback=lambda f: f.formfield(),
+                      formset=BaseModelFormSet, extra=1, orderable=False, deletable=False, fields=None):
+    """
+    Returns a FormSet class for the given Django model class. This FormSet
+    will contain change forms for every instance of the given model as well
+    as the number of add forms specified by ``extra``.
+    
+    This is essentially the same as ``formset_for_queryset``, but automatically
+    uses the model's default manager to determine the queryset.
+    """
+    qs = model._default_manager.all()
+    return formset_for_queryset(qs, form, formfield_callback, formset, extra, orderable, deletable, fields)
+
 class InlineFormset(BaseModelFormSet):
     """A formset for child objects related to a parent."""
-    def __init__(self, instance=None, data=None, files=None):
+    def __init__(self, instance, data=None, files=None):
         from django.db.models.fields.related import RelatedObject
         self.instance = instance
         # is there a better way to get the object descriptor?
         self.rel_name = RelatedObject(self.fk.rel.to, self.model, self.fk).get_accessor_name()
-        super(InlineFormset, self).__init__(data, files, instances=self.get_inline_objects(), prefix=self.rel_name)
+        super(InlineFormset, self).__init__(data, files, prefix=self.rel_name)
 
-    def get_inline_objects(self):
-        if self.instance is None:
-            return []
-        return getattr(self.instance, self.rel_name).all()
+    def get_queryset(self):
+        """
+        Returns this FormSet's queryset, but restricted to children of 
+        self.instance
+        """
+        kwargs = {self.fk.name: self.instance}
+        return self.queryset.filter(**kwargs)
 
     def save_new(self, form, commit=True):
         kwargs = {self.fk.get_attname(): self.instance._get_pk_val()}
         new_obj = self.model(**kwargs)
         return save_instance(form, new_obj, commit=commit)
 
-def inline_formset(parent_model, model, fk_name=None, fields=None, extra=3, orderable=False, deletable=True, formfield_callback=lambda f: f.formfield()):
+def get_foreign_key(parent_model, model, fk_name=None):
     """
-    Returns an ``InlineFormset`` for the given kwargs.
-
-    You must provide ``fk_name`` if ``model`` has more than one ``ForeignKey``
-    to ``parent_model``.
+    Finds and returns the ForeignKey from model to parent if there is one.
+    If fk_name is provided, assume it is the name of the ForeignKey field.
     """
+    # avoid circular import
     from django.db.models import ForeignKey
     opts = model._meta
-    # figure out what the ForeignKey from model to parent_model is
-    if fk_name is None:
-        fks_to_parent = [f for f in opts.fields if isinstance(f, ForeignKey) and f.rel.to == parent_model]
-        if len(fks_to_parent) == 1:
-            fk = fks_to_parent[0]
-        elif len(fks_to_parent) == 0:
-            raise Exception("%s has no ForeignKey to %s" % (model, parent_model))
-        else:
-            raise Exception("%s has more than 1 ForeignKey to %s" % (model, parent_model))
-    else:
+    if fk_name:
         fks_to_parent = [f for f in opts.fields if f.name == fk_name]
         if len(fks_to_parent) == 1:
             fk = fks_to_parent[0]
@@ -337,6 +372,26 @@ def inline_formset(parent_model, model, fk_name=None, fields=None, extra=3, orde
                 raise Exception("fk_name '%s' is not a ForeignKey to %s" % (fk_name, parent_model))
         elif len(fks_to_parent) == 0:
             raise Exception("%s has no field named '%s'" % (model, fk_name))
+    else:
+        # Try to discover what the ForeignKey from model to parent_model is
+        fks_to_parent = [f for f in opts.fields if isinstance(f, ForeignKey) and f.rel.to == parent_model]
+        if len(fks_to_parent) == 1:
+            fk = fks_to_parent[0]
+        elif len(fks_to_parent) == 0:
+            raise Exception("%s has no ForeignKey to %s" % (model, parent_model))
+        else:
+            raise Exception("%s has more than 1 ForeignKey to %s" % (model, parent_model))
+    return fk
+
+def inline_formset(parent_model, model, fk_name=None, fields=None, extra=3,
+                   orderable=False, deletable=True, formfield_callback=lambda f: f.formfield()):
+    """
+    Returns an ``InlineFormset`` for the given kwargs.
+
+    You must provide ``fk_name`` if ``model`` has more than one ``ForeignKey``
+    to ``parent_model``.
+    """
+    fk = get_foreign_key(parent_model, model, fk_name=fk_name)
     # let the formset handle object deletion by default
     FormSet = formset_for_model(model, formset=InlineFormset, fields=fields,
                                 formfield_callback=formfield_callback,
@@ -349,7 +404,5 @@ def inline_formset(parent_model, model, fk_name=None, fields=None, extra=3, orde
         del FormSet.form_class.base_fields[fk.name]
     except KeyError:
         pass
-    FormSet.parent_model = parent_model
-    FormSet.fk_name = fk.name
     FormSet.fk = fk
     return FormSet
diff --git a/tests/modeltests/model_formsets/__init__.py b/tests/modeltests/model_formsets/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/modeltests/model_formsets/models.py b/tests/modeltests/model_formsets/models.py
new file mode 100644
index 0000000..8abc9f8
--- /dev/null
+++ b/tests/modeltests/model_formsets/models.py
@@ -0,0 +1,162 @@
+from django.db import models
+
+class Author(models.Model):
+    name = models.CharField(max_length=100)
+
+    def __unicode__(self):
+        return self.name
+
+class Book(models.Model):
+    author = models.ForeignKey(Author)
+    title = models.CharField(max_length=100)
+
+    def __unicode__(self):
+        return self.title
+
+
+__test__ = {'API_TESTS': """
+
+>>> from django.newforms.models import formset_for_queryset, formset_for_model
+
+>>> qs = Author.objects.all()
+>>> AuthorFormSet = formset_for_model(Author, extra=3)
+
+>>> formset = AuthorFormSet()
+>>> for form in formset.forms:
+...     print form.as_p()
+<p><label for="id_form-0-name">Name:</label> <input id="id_form-0-name" type="text" name="form-0-name" maxlength="100" /><input type="hidden" name="form-0-id" id="id_form-0-id" /></p>
+<p><label for="id_form-1-name">Name:</label> <input id="id_form-1-name" type="text" name="form-1-name" maxlength="100" /><input type="hidden" name="form-1-id" id="id_form-1-id" /></p>
+<p><label for="id_form-2-name">Name:</label> <input id="id_form-2-name" type="text" name="form-2-name" maxlength="100" /><input type="hidden" name="form-2-id" id="id_form-2-id" /></p>
+
+>>> data = {
+...     'form-COUNT': '3',
+...     'form-0-name': 'Charles Baudelaire',
+...     'form-1-name': 'Arthur Rimbaud',
+...     'form-2-name': '',
+... }
+
+>>> formset = AuthorFormSet(data=data)
+>>> formset.is_valid()
+True
+
+>>> formset.save()
+[<Author: Charles Baudelaire>, <Author: Arthur Rimbaud>]
+
+>>> for author in Author.objects.order_by('name'):
+...     print author.name
+Arthur Rimbaud
+Charles Baudelaire
+
+
+Gah! We forgot Paul Verlaine. Let's create a formset to edit the existing
+authors with an extra form to add him. This time we'll use formset_for_queryset.
+We *could* use formset_for_queryset to restrict the Author objects we edit,
+but in that case we'll use it to display them in alphabetical order by name.
+
+>>> qs = Author.objects.order_by('name')
+>>> AuthorFormSet = formset_for_queryset(qs, extra=1, deletable=False)
+
+>>> formset = AuthorFormSet()
+>>> for form in formset.forms:
+...     print form.as_p()
+<p><label for="id_form-0-name">Name:</label> <input id="id_form-0-name" type="text" name="form-0-name" value="Arthur Rimbaud" maxlength="100" /><input type="hidden" name="form-0-id" value="2" id="id_form-0-id" /></p>
+<p><label for="id_form-1-name">Name:</label> <input id="id_form-1-name" type="text" name="form-1-name" value="Charles Baudelaire" maxlength="100" /><input type="hidden" name="form-1-id" value="1" id="id_form-1-id" /></p>
+<p><label for="id_form-2-name">Name:</label> <input id="id_form-2-name" type="text" name="form-2-name" maxlength="100" /><input type="hidden" name="form-2-id" id="id_form-2-id" /></p>
+
+
+>>> data = {
+...     'form-COUNT': '3',
+...     'form-0-id': '2',
+...     'form-0-name': 'Arthur Rimbaud',
+...     'form-1-id': '1',
+...     'form-1-name': 'Charles Baudelaire',
+...     'form-2-name': 'Paul Verlaine',
+... }
+
+>>> formset = AuthorFormSet(data=data)
+>>> formset.is_valid()
+True
+
+>>> formset.save()
+[<Author: Arthur Rimbaud>, <Author: Charles Baudelaire>, <Author: Paul Verlaine>]
+
+>>> for author in Author.objects.order_by('name'):
+...     print author.name
+Arthur Rimbaud
+Charles Baudelaire
+Paul Verlaine
+
+
+
+We can also create a formset that is tied to a parent model. This is how the
+admin system's edit inline functionality works.
+
+>>> from django.newforms.models import inline_formset
+
+>>> AuthorBooksFormSet = inline_formset(Author, Book, deletable=False, extra=3)
+>>> author = Author.objects.get(name='Charles Baudelaire')
+
+>>> formset = AuthorBooksFormSet(author)
+>>> for form in formset.forms:
+...     print form.as_p()
+<p><label for="id_book_set-0-title">Title:</label> <input id="id_book_set-0-title" type="text" name="book_set-0-title" maxlength="100" /><input type="hidden" name="book_set-0-id" id="id_book_set-0-id" /></p>
+<p><label for="id_book_set-1-title">Title:</label> <input id="id_book_set-1-title" type="text" name="book_set-1-title" maxlength="100" /><input type="hidden" name="book_set-1-id" id="id_book_set-1-id" /></p>
+<p><label for="id_book_set-2-title">Title:</label> <input id="id_book_set-2-title" type="text" name="book_set-2-title" maxlength="100" /><input type="hidden" name="book_set-2-id" id="id_book_set-2-id" /></p>
+
+>>> data = {
+...     'book_set-COUNT': '3',
+...     'book_set-0-title': 'Les Fleurs du Mal',
+...     'book_set-1-title': '',
+...     'book_set-2-title': '',
+... }
+
+>>> formset = AuthorBooksFormSet(author, data=data)
+>>> formset.is_valid()
+True
+
+>>> formset.save()
+[<Book: Les Fleurs du Mal>]
+
+>>> for book in author.book_set.all():
+...     print book.title
+Les Fleurs du Mal
+
+
+Now that we've added a book to Charles Baudelaire, let's try adding another
+one. This time though, an edit form will be available for every existing
+book.
+
+>>> AuthorBooksFormSet = inline_formset(Author, Book, deletable=False, extra=2)
+>>> author = Author.objects.get(name='Charles Baudelaire')
+
+>>> formset = AuthorBooksFormSet(author)
+>>> for form in formset.forms:
+...     print form.as_p()
+<p><label for="id_book_set-0-title">Title:</label> <input id="id_book_set-0-title" type="text" name="book_set-0-title" value="Les Fleurs du Mal" maxlength="100" /><input type="hidden" name="book_set-0-id" value="1" id="id_book_set-0-id" /></p>
+<p><label for="id_book_set-1-title">Title:</label> <input id="id_book_set-1-title" type="text" name="book_set-1-title" maxlength="100" /><input type="hidden" name="book_set-1-id" id="id_book_set-1-id" /></p>
+<p><label for="id_book_set-2-title">Title:</label> <input id="id_book_set-2-title" type="text" name="book_set-2-title" maxlength="100" /><input type="hidden" name="book_set-2-id" id="id_book_set-2-id" /></p>
+
+>>> data = {
+...     'book_set-COUNT': '3',
+...     'book_set-0-id': '1',
+...     'book_set-0-title': 'Les Fleurs du Mal',
+...     'book_set-1-title': 'Le Spleen de Paris',
+...     'book_set-2-title': '',
+... }
+
+>>> formset = AuthorBooksFormSet(author, data=data)
+>>> formset.is_valid()
+True
+
+>>> formset.save()
+[<Book: Les Fleurs du Mal>, <Book: Le Spleen de Paris>]
+
+As you can see, 'Le Spleen de Paris' is now a book belonging to Charles Baudelaire.
+
+>>> for book in author.book_set.order_by('title'):
+...     print book.title
+Le Spleen de Paris
+Les Fleurs du Mal
+
+
+"""}
