How To Make Flask-wtf Validate Override Execute Properly
I have created a simple form which contains a URLField and StringField. As shown below: from flask_wtf import Form from wtforms.fields import StringField from wtforms.fields.html5
Solution 1:
I faced the same/similar issue where only the first conditio would be evaulated in this code
if not self.url.data.startswith("http://") or\
self.url.data.startswith("https://"):
self.url.data = "http://" + self.url.data
You need add () for the OR logic:
if not (self.url.data.startswith("http://") or\
self.url.data.startswith("https://")):
self.url.data = "http://" + self.url.data
Post a Comment for "How To Make Flask-wtf Validate Override Execute Properly"