diff options
| author | Brian Rosner <brosner@gmail.com> | 2008-09-02 17:26:24 +0000 |
|---|---|---|
| committer | Brian Rosner <brosner@gmail.com> | 2008-09-02 17:26:24 +0000 |
| commit | c1de41f4d29d15616075ffd474e3aba7adcfc64f (patch) | |
| tree | f00fbc0995eb98d62438b58ae223d2b84cc0c2f3 /docs/ref | |
| parent | 326b26656aa3770be99da88dd76e7eb9c73d1dc5 (diff) | |
Fixed #7973 -- Added exclude to BaseModelAdmin to make everything consistent with the form/formset factories. Refs #8071 to make it easier to get at exclude. Thanks julien for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8861 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/contrib/admin.txt | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/ref/contrib/admin.txt b/docs/ref/contrib/admin.txt index ceb33bc40a..da2f8a7e53 100644 --- a/docs/ref/contrib/admin.txt +++ b/docs/ref/contrib/admin.txt @@ -181,6 +181,32 @@ displayed, sequentially, in the form. dictionary key that is within the ``fieldsets`` option, as described in the previous section. +``exclude`` +~~~~~~~~~~~ + +This attribute, if given, should be a list of field names to exclude from the +form. + +For example, let's consider the following model:: + + class Author(models.Model): + name = models.CharField(max_length=100) + title = models.CharField(max_length=3) + birth_date = models.DateField(blank=True, null=True) + +If you want a form for the ``Author`` model that includes only the ``name`` +and ``title`` fields, you would specify ``fields`` or ``exclude`` like this:: + + class AuthorAdmin(admin.ModelAdmin): + fields = ('name', 'title') + + class AuthorAdmin(admin.ModelAdmin): + exclude = ('birth_date',) + +Since the Author model only has three fields, ``name``, ``title``, and +``birth_date``, the forms resulting from the above declarations will contain +exactly the same fields. + ``filter_horizontal`` ~~~~~~~~~~~~~~~~~~~~~ |
