I'm dynamically constructing form, many of the building blocks are forms that get encapsulated in the Form as FormFields: e.g.:
class EmailAddressForm(Form):
email_address = TextField("email address", validators = [Email(message=(u'That\'s not a valid email address.'))] )
then called when constructing the form:
def email(self):
return FormField(EmailAddressForm)
Note: adding csrf_enabled=false to addressform above is an error: TypeError: 'EmailAddressForm' object is not callable
so when the form is constructed and displayed, I get (excuse the mess, but really obnoxious id's removed)
<table id=""><tr><th><label for="-csrf_token">Csrf Token</label></th><td><input id="-csrf_token" name="-csrf_token" type="hidden" value="20121004121155##f2c748b3ab4113f19eed02cdb8bfe977aca840ec"></td></tr><tr><th><label for="-email_address">Email Address</label></th><td><input id="-email_address" name="n3j0e3_221a89d0f0d3af2c-email_address" type="text" value=""></td></tr></table></div>
Which you can see a csrf token, which is unneeded in the the sub-form. Is there a way to turn this off other than the documented way, why am I getting this? The csrf for the primary form itself works well (so far), and if i pass in (csrf_enabled=False) to the main form, there is no error -- there seems to be no way to turn off csrf in FormFields constructed from Form
tried so far:
class EmailAddressForm(Form(csrf_enabled=false)):
email_address = TextField("email address", validators = [Email(message=(u'That\'s not a valid email address.'))] )
is a RuntimeError('working outside of application context')
def email(self):
return FormField(EmailAddressForm, csrf_enabled=False)
returns an TypeError: init() got an unexpected keyword argument 'csrf_enabled'
def email(self):
return FormField(EmailAddressForm(csrf_enabled=false))
Note: adding is an error: TypeError: 'EmailAddressForm' object is not callable
CSRF_ENABLED = False in settings -- Still get the csrf field :/
visual: http://imgur.com/Dhfj7