diff options
| author | Jannis Leidel <jannis@leidel.info> | 2011-08-12 14:14:49 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2011-08-12 14:14:49 +0000 |
| commit | 3d027b72ebaf3fa41c9f6c17873fe3cee08d9007 (patch) | |
| tree | 0bf5fd2433e4b72c1b40d8b8916212f46af653b6 /docs/ref | |
| parent | e912edec20f4d81d1b5c1a02bede1632f3beaa83 (diff) | |
Fixed #14496 -- Fixed conflict between ModelForm exclude and ModelAdmin readonly values. Thanks, Julien Phalip.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16602 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/contrib/admin/index.txt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index 43057a31b0..3cd8279234 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -313,6 +313,24 @@ subclass:: For an example see the section `Adding custom validation to the admin`_. + .. admonition:: Note + + If your ``ModelForm`` and ``ModelAdmin`` both define an ``exclude`` + option then ``ModelAdmin`` takes precedence:: + + class PersonForm(forms.ModelForm): + + class Meta: + model = Person + exclude = ['name'] + + class PersonAdmin(admin.ModelAdmin): + exclude = ['age'] + form = PersonForm + + In the above example, the "age" field will be excluded but the "name" + field will be included in the generated form. + .. attribute:: ModelAdmin.formfield_overrides This provides a quick-and-dirty way to override some of the |
