Re: DRYing up my forms.py

2012-08-04 Thread Tomas Neme
But if you subclass the widget, then you'll need to override every form's widget with { forms.DateField: MyDateWidget } so overriding and using your own MyDateField would be less verbose and repetitive On Sat, Aug 4, 2012 at 6:17 PM, Melvyn Sopacua wrote: > On 3-8-2012

Re: DRYing up my forms.py

2012-08-04 Thread Melvyn Sopacua
On 3-8-2012 18:23, Lee Hinde wrote: > > On Aug 3, 2012, at 9:01 AM, Melvyn Sopacua wrote: > >> On 3-8-2012 17:37, Lee Hinde wrote: >> >>> self.fields['photo_response'].widget.attrs["class"] = 'date-field >>> input-small' >>> self.fields['photo_response'].widget.format =

Re: DRYing up my forms.py

2012-08-03 Thread Lee Hinde
On Aug 3, 2012, at 9:01 AM, Melvyn Sopacua wrote: > On 3-8-2012 17:37, Lee Hinde wrote: > >> self.fields['photo_response'].widget.attrs["class"] = 'date-field >> input-small' >> self.fields['photo_response'].widget.format = '%m-%d-%Y' >> >> >> is there a way to

Re: DRYing up my forms.py

2012-08-03 Thread Melvyn Sopacua
On 3-8-2012 17:37, Lee Hinde wrote: > self.fields['photo_response'].widget.attrs["class"] = 'date-field input-small' > self.fields['photo_response'].widget.format = '%m-%d-%Y' > > > is there a way to consolidate this sort of thing, such that if a field > is a date field, it always gets these

DRYing up my forms.py

2012-08-03 Thread Lee Hinde
I have a lot of this throughout my forms.py files: self.fields['verification_date'].widget.attrs["class"] = 'date-field input-small' self.fields['verification_date'].widget.format = '%m-%d-%Y' self.fields['mail_response'].widget.attrs["class"] = 'date-field input-small'