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 the current password, the form needs to know the user it
> is validating against.
>
> I have suggested an enhancement to newforms that would potentially
> solve this issue.
>
> 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 support, I'll be happy to put together a patch.

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, **kwargs)
        self.user = user

I agree that its a little bit more typing, but its also more generic
and doesn't add functionality that will be left unused in 9 uses out
of ten.

just my 2c's...

>
>  - Ben
>
> >
>


-- 
Honza Kr�l
E-Mail: [EMAIL PROTECTED]
ICQ#:   107471613
Phone:  +420 606 678585

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to