Re: Allow changing form field properties after form creation

2012-06-08 Thread Chris Wilson
Hi Simon, On Fri, 6 Apr 2012, Simon Meers wrote: On 6 April 2012 07:26, Beres Botond wrote: Isn't it this what you are trying to do? class DocumentForm(ModelForm):        def __init__(self, *args, **kwargs):                super(MyForm, self).__init__(*args, **kwargs)                self.fie

Re: Allow changing form field properties after form creation

2012-04-05 Thread Simon Meers
On 6 April 2012 07:26, Beres Botond wrote: > Hi Chris, > > Isn't it this what you are trying to do? > > class DocumentForm(ModelForm): >        def __init__(self, *args, **kwargs): >                super(MyForm, self).__init__(*args, **kwargs) >                self.fields['title'].required = False

Re: Allow changing form field properties after form creation

2012-04-05 Thread Beres Botond
Hi Chris, Isn't it this what you are trying to do? class DocumentForm(ModelForm): def __init__(self, *args, **kwargs): super(MyForm, self).__init__(*args, **kwargs) self.fields['title'].required = False Which works perfectly fine. You can tweak pretty much

Re: Allow changing form field properties after form creation

2012-04-05 Thread Chris Wilson
Hi Brian, On Thu, 5 Apr 2012, Brian Neal wrote: On Thursday, April 5, 2012 6:49:20 AM UTC-5, Chris Wilson wrote: class DocumentForm(ModelForm):      title = models.Document._meta.get_field('title').formfield(required=False) You can already replace and tweak the fields in a w

Re: Allow changing form field properties after form creation

2012-04-05 Thread Brian Neal
On Thursday, April 5, 2012 6:49:20 AM UTC-5, Chris Wilson wrote: > > Hi all, > > I've added this as a ticket but I wanted to make sure that the core > and forms developers have a chance to see and interact with it, so I'm > posting it here too. You can find the ticket at: >

Re: Allow changing form field properties after form creation

2012-04-05 Thread Chris Wilson
Hi Nate, On Thu, 5 Apr 2012, Nate Bragg wrote: They don't "have" to be replaced in a subclass in the way you showed. Perhaps it isn't perfectly DRY, but whats so bad about naming the field explicitly? The fact that we're building reusable components and we want people to be able to subclass

Re: Allow changing form field properties after form creation

2012-04-05 Thread Nate Bragg
They don't "have" to be replaced in a subclass in the way you showed. Perhaps it isn't perfectly DRY, but whats so bad about naming the field explicitly? Anyhow, when it comes specifically to widgets, the Meta class already has a 'widgets' attribute already that lets you specify that. I would soo

Allow changing form field properties after form creation

2012-04-05 Thread Chris Wilson
Hi all, I've added this as a ticket but I wanted to make sure that the core and forms developers have a chance to see and interact with it, so I'm posting it here too. You can find the ticket at: Currently, if I want to tweak the properties of so