From 3d027b72ebaf3fa41c9f6c17873fe3cee08d9007 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Fri, 12 Aug 2011 14:14:49 +0000 Subject: 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 --- docs/ref/contrib/admin/index.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'docs') 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 -- cgit v1.3