Changes between Initial Version and Version 1 of Ticket #25702


Ignore:
Timestamp:
Nov 7, 2015, 10:32:23 AM (9 years ago)
Author:
Laurent Peuch
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #25702 – Description

    initial v1  
    4343While not going to all the extend of what django-cripsy-forms or another project is doing, //fieldset// is an already known and used convention accross the django project and allowing it in standard forms seems like a natural and intuitive choice.
    4444
     45Regarding 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
     47This would look like this:
     48
     49{{{#!python
     50from django import forms
     51
     52class 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
    4569[=#point1 (1)] http://django-crispy-forms.readthedocs.org/en/latest/layouts.html
Back to Top