Changes between Initial Version and Version 1 of Ticket #17325


Ignore:
Timestamp:
Dec 7, 2011, 9:28:36 AM (13 years ago)
Author:
Aymeric Augustin
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #17325 – Description

    initial v1  
    1 I like to use forms a lot, but sometimes I have to overwrite __init__ to accept some parameters that change the behaviour of the validation, I was thinking that maybe is better just to add a way to pass some data to the validation methods of the form in order to validate it.
     1I like to use forms a lot, but sometimes I have to overwrite `__init__` to accept some parameters that change the behaviour of the validation, I was thinking that maybe is better just to add a way to pass some data to the validation methods of the form in order to validate it.
    22
    3 Imagine that I want to create a form to change the email of an user and I don't want to use an argument in the request for "username" and use the username from the session framework (I just want to avoid to send the username in the request), I will have to overwrite the __init__ of the form in order to accept "user" as an argument and store it in self.user to be used later in clean_email. Instead, if we have this new argument in is_valid is just to do: form.is_valid(user=user).
     3Imagine that I want to create a form to change the email of an user and I don't want to use an argument in the request for "username" and use the username from the session framework (I just want to avoid to send the username in the request), I will have to overwrite the `__init__` of the form in order to accept "user" as an argument and store it in `self.user` to be used later in `clean_email`. Instead, if we have this new argument in `is_valid` is just to do: `form.is_valid(user=user)`.
    44
    55This new argument doesn't hurt anyone, and It will help a lot to some of us that use form in this way.
Back to Top