Author: russellm
Date: 2009-09-12 22:01:04 -0500 (Sat, 12 Sep 2009)
New Revision: 11549

Modified:
   django/trunk/docs/topics/forms/modelforms.txt
Log:
Fixed #11755 -- Added documentation for an edge case of FormSet usage. Thanks 
to ffualo for the suggestion.

Modified: django/trunk/docs/topics/forms/modelforms.txt
===================================================================
--- django/trunk/docs/topics/forms/modelforms.txt       2009-09-13 01:35:18 UTC 
(rev 11548)
+++ django/trunk/docs/topics/forms/modelforms.txt       2009-09-13 03:01:04 UTC 
(rev 11549)
@@ -374,24 +374,24 @@
 .. note::
 
     If you explicitly instantiate a form field like this, Django assumes that 
you
-    want to completely define its behavior; therefore, default attributes 
(such as 
-    ``max_length`` or ``required``) are not drawn from the corresponding 
model. If 
+    want to completely define its behavior; therefore, default attributes 
(such as
+    ``max_length`` or ``required``) are not drawn from the corresponding 
model. If
     you want to maintain the behavior specified in the model, you must set the
     relevant arguments explicitly when declaring the form field.
 
     For example, if the ``Article`` model looks like this::
 
         class Article(models.Model):
-            headline = models.CharField(max_length=200, null=True, blank=True, 
+            headline = models.CharField(max_length=200, null=True, blank=True,
                                         help_text="Use puns liberally")
             content = models.TextField()
 
     and you want to do some custom validation for ``headline``, while keeping
-    the ``blank`` and ``help_text`` values as specified, you might define 
+    the ``blank`` and ``help_text`` values as specified, you might define
     ``ArticleForm`` like this::
 
         class ArticleForm(ModelForm):
-            headline = MyFormField(max_length=200, required=False, 
+            headline = MyFormField(max_length=200, required=False,
                                    help_text="Use puns liberally")
 
             class Meta:
@@ -541,6 +541,12 @@
 
     >>> AuthorFormSet = modelformset_factory(Author, formset=BaseAuthorFormSet)
 
+If you want to return a formset that doesn't include *any* pre-existing
+instances of the model, you can specify an empty QuerySet::
+
+   >>> AuthorFormSet(queryset=Author.objects.none())
+
+
 Controlling which fields are used with ``fields`` and ``exclude``
 -----------------------------------------------------------------
 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to