1 | | Suppose we have this forms.py: http://codepad.org/HIt9bBtA |
| 1 | Suppose we have this forms.py: |
| 2 | |
| 3 | {{{ |
| 4 | class SubmitButtonField(forms.Field): |
| 5 | # here we write a custom field.... |
| 6 | |
| 7 | class Editor(forms.Form): |
| 8 | script_name = forms.CharField(max_length=60, min_length=1) |
| 9 | view_level = forms.ChoiceField(widget=forms.widgets.RadioSelect, choices=VIEW_LEVEL) |
| 10 | text_box = forms.CharField(widget=forms.widgets.Textarea, required=False) |
| 11 | save_button = forms.SubmitButtonField(required=False) |
| 12 | |
| 13 | # notice save_button above.... |
| 14 | }}} |