summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorBrian Rosner <brosner@gmail.com>2008-08-15 21:37:34 +0000
committerBrian Rosner <brosner@gmail.com>2008-08-15 21:37:34 +0000
commit8edb4f97c749bc21846f058d2bf4137893bce481 (patch)
treec101f1180a2a2c8e0864597d8c7ee17d7acc44b3 /docs
parent6a71c768bc3f3eef34f9fe12cc7a2fa0f1cc05ab (diff)
Fixed #8299 -- Clarified the ModelAdmin.form option. Also added an inner Meta class to the ModelForm example in adding custom validation to the admin. Thanks jarrow for the report and initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8395 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/admin.txt14
1 files changed, 11 insertions, 3 deletions
diff --git a/docs/admin.txt b/docs/admin.txt
index 03c0154331..30513971b2 100644
--- a/docs/admin.txt
+++ b/docs/admin.txt
@@ -72,9 +72,14 @@ Example::
``form``
~~~~~~~~
-The default ``forms.ModelForm`` class used to generate the form on the
-add/change pages for models. You can easily change this to your own
-``ModelForm`` to override the default form behavior of the add/change pages.
+By default a ``ModelForm`` is dynamically created for your model. It is used
+to create the form presented on both the add/change pages. You can easily
+provide your own ``ModelForm`` to override any default form behavior on the
+add/change pages.
+
+For an example see the section `Adding custom validation to the admin`_.
+
+.. _Adding custom validation to the admin: #adding-custom-validation-to-the-admin
``fieldsets``
~~~~~~~~~~~~~
@@ -617,6 +622,9 @@ needed. Now within your form you can add your own custom validation for
any field::
class MyArticleAdminForm(forms.ModelForm):
+ class Meta:
+ model = Article
+
def clean_name(self):
# do something that validates your data
return self.cleaned_data["name"]