Created
February 14, 2014 09:16
-
-
Save kezabelle/8998121 to your computer and use it in GitHub Desktop.
For bt4 on #django IRC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyForm(Form): | |
def __init__(self, request, *args, **kwargs): | |
user = request.user | |
super(MyForm, self).__init__(*args, **kwargs) | |
def my_fake_validator(value): | |
return my_real_validator(value, user) | |
# can't remember if this is the right syntax | |
self.fields['myfield'].validators.append(my_fake_validator) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment