Skip to content

Tag: flask-wtforms

How to call a variable outside a validate() function which is inside the FlaskForm class

I have two def validate(self) functions within the RegistrationForm(FlaskForm). First function validates the user input if the car range is over 400km. The other function validates if the user lives far or close to work by calculating the distance between the user’s address and work address by means of geopy module. I’ve been told that def validate_field(self, field): function takes

Using uk-postcode-utils in a python form

I am creating a form for the user to enter a valid UK postcode. I currently have the following code for the form: and the template is: but getting the error: TypeError: argument of type ‘StringField’ is not iterable. What can I do to fix this? Edit: Here are the complete form entry and the template for the webpage. Thanks