| | 45 | Regarding the API, I'm wondering if puting the //fieldset// attribute in the //Meta// class doesn't make more sens since it is already used (only for the //ModelForm//?) to specify options and this will avoid a conflict with currently existing fields named //fieldset//. |
| | 46 | |
| | 47 | This would look like this: |
| | 48 | |
| | 49 | {{{#!python |
| | 50 | from django import forms |
| | 51 | |
| | 52 | class ContactForm(forms.Form): |
| | 53 | subject = forms.CharField(max_length=100) |
| | 54 | message = forms.CharField(widget=forms.Textarea) |
| | 55 | sender = forms.EmailField() |
| | 56 | cc_myself = forms.BooleanField(required=False) |
| | 57 | |
| | 58 | class Meta: |
| | 59 | fieldset = ( |
| | 60 | (None, { |
| | 61 | "fields": (('sender', 'cc_myself'),), |
| | 62 | }), |
| | 63 | ("Content", { |
| | 64 | "fields": ("subject", "message"), |
| | 65 | }), |
| | 66 | ) |
| | 67 | }}} |
| | 68 | |