Ticket #8299: form-attribute-doc-fix-00.diff
File form-attribute-doc-fix-00.diff, 1.2 KB (added by , 16 years ago) |
---|
-
docs/admin.txt
72 72 ``form`` 73 73 ~~~~~~~~ 74 74 75 The default ``forms.ModelForm`` class used to generate the form on the 76 add/change pages for models. You can easily change this to your own 77 ``ModelForm`` to override the default form behavior of the add/change pages. 75 By default a subclass of ``forms.ModelForm`` is automatically generated for 76 your model. It is used to create the forms on the add/change pages. You can 77 easily change this subclass to your own ``ModelForm`` to override the default 78 form behavior of the add/change pages. 79 80 For an example see the section `Adding custom validation to the admin`_. 78 81 79 82 ``fieldsets`` 80 83 ~~~~~~~~~~~~~ … … 589 592 needed. Now within your form you can add your own custom validation for 590 593 any field:: 591 594 592 class MyArticleAdminForm(forms.ModelForm): 595 class MyArticleAdminForm(forms.ModelForm): 596 class Meta: 597 model = MyModel 593 598 def clean_name(self): 594 599 # do something that validates your data 595 600 return self.cleaned_data["name"]