Re: Passing external data to Form objects in newforms

2007-02-12 Thread whiteinge
Speaking as a Python newbie who is currently learning Django then OOP (i.e. the opposite of the logical, preferred order), I would really love documentation on this sort of thing. I wrote a hackish workaround to a very similar problem just yesterday which I can currently updating with your example

Re: Passing external data to Form objects in newforms

2007-02-11 Thread Benjamin Slavin
On 2/11/07, Adrian Holovaty <[EMAIL PROTECTED]> wrote: > > As Honza suggested, you're already able to do this in a *much* more > generic fashion by simply subclassing the form and implementing > __init__(). I'm marking the ticket as a wontfix. Fair enough. Is there any interest in adding this to

Re: Passing external data to Form objects in newforms

2007-02-11 Thread Adrian Holovaty
On 2/11/07, Benjamin Slavin <[EMAIL PROTECTED]> wrote: > Please see the ticket located at: > http://code.djangoproject.com/ticket/3479 > > In terms of coding this, it's a trivial change with tremendous benefit > for users and wouldn't hurt backwards compatibility within newforms. > If there's supp

Re: Passing external data to Form objects in newforms

2007-02-11 Thread Benjamin Slavin
On 2/11/07, Honza Král <[EMAIL PROTECTED]> wrote: > > true, but what would happen if you added two lines (or worse - an > extra argument to a generic function/method) for everything that 10% > of people would use and is easily (even though maybe little clumsily) > done without it? Certainly nothin

Re: Passing external data to Form objects in newforms

2007-02-11 Thread Honza Král
On 2/12/07, Benjamin Slavin <[EMAIL PROTECTED]> wrote: > > On 2/11/07, Honza Kr�l <[EMAIL PROTECTED]> wrote: > > > > is this really necessary ? since you always subclass formsForm, why > > wouldn't you use: > > class PasswordChangeForm(forms.Form): > > def __init__( self, user, *args, **kwargs

Re: Passing external data to Form objects in newforms

2007-02-11 Thread Benjamin Slavin
On 2/11/07, Honza Král <[EMAIL PROTECTED]> wrote: > > is this really necessary ? since you always subclass formsForm, why > wouldn't you use: > class PasswordChangeForm(forms.Form): > def __init__( self, user, *args, **kwargs ): > super(PasswordChangeForm, self ).__init__( *args, **kwa

Re: Passing external data to Form objects in newforms

2007-02-11 Thread Honza Král
On 2/11/07, Benjamin Slavin <[EMAIL PROTECTED]> wrote: > > I've run into a few situations where I need to pass data into a Form > for validation. > > Consider, for example, a 'change password' form. > Validation of the current password is required to ensure correct > authorization. > To validate t

Passing external data to Form objects in newforms

2007-02-11 Thread Benjamin Slavin
I've run into a few situations where I need to pass data into a Form for validation. Consider, for example, a 'change password' form. Validation of the current password is required to ensure correct authorization. To validate the current password, the form needs to know the user it is validating