mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-04-28 17:32:38 +02:00
Support WTForms 3 (#916)
* Support WTForms 3 * default value to None for WTForm backward compatibility * switch back to empty string as default WTForm backward compatibility needs that * format
This commit is contained in:
parent
023ec71536
commit
40ce32d9fa
3 changed files with 20 additions and 5 deletions
|
@ -3,7 +3,7 @@ from functools import wraps
|
||||||
from flask import current_app, request
|
from flask import current_app, request
|
||||||
from flask_restful import Resource, abort
|
from flask_restful import Resource, abort
|
||||||
from werkzeug.security import check_password_hash
|
from werkzeug.security import check_password_hash
|
||||||
from wtforms.fields.core import BooleanField
|
from wtforms.fields import BooleanField
|
||||||
|
|
||||||
from ihatemoney.currency_convertor import CurrencyConverter
|
from ihatemoney.currency_convertor import CurrencyConverter
|
||||||
from ihatemoney.emails import send_creation_email
|
from ihatemoney.emails import send_creation_email
|
||||||
|
|
|
@ -9,9 +9,23 @@ from flask_wtf.file import FileAllowed, FileField, FileRequired
|
||||||
from flask_wtf.form import FlaskForm
|
from flask_wtf.form import FlaskForm
|
||||||
from markupsafe import Markup
|
from markupsafe import Markup
|
||||||
from werkzeug.security import check_password_hash, generate_password_hash
|
from werkzeug.security import check_password_hash, generate_password_hash
|
||||||
from wtforms.fields.core import Label, SelectField, SelectMultipleField
|
from wtforms.fields import (
|
||||||
from wtforms.fields.html5 import DateField, DecimalField, URLField
|
BooleanField,
|
||||||
from wtforms.fields.simple import BooleanField, PasswordField, StringField, SubmitField
|
DateField,
|
||||||
|
DecimalField,
|
||||||
|
Label,
|
||||||
|
PasswordField,
|
||||||
|
SelectField,
|
||||||
|
SelectMultipleField,
|
||||||
|
StringField,
|
||||||
|
SubmitField,
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Compat for WTForms <= 2.3.3
|
||||||
|
from wtforms.fields.html5 import URLField
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
from wtforms.fields import URLField
|
||||||
from wtforms.validators import (
|
from wtforms.validators import (
|
||||||
URL,
|
URL,
|
||||||
DataRequired,
|
DataRequired,
|
||||||
|
@ -312,6 +326,7 @@ class BillForm(FlaskForm):
|
||||||
original_currency = SelectField(_("Currency"), validators=[DataRequired()])
|
original_currency = SelectField(_("Currency"), validators=[DataRequired()])
|
||||||
external_link = URLField(
|
external_link = URLField(
|
||||||
_("External link"),
|
_("External link"),
|
||||||
|
default="",
|
||||||
validators=[Optional(), URL()],
|
validators=[Optional(), URL()],
|
||||||
description=_("A link to an external document, related to this bill"),
|
description=_("A link to an external document, related to this bill"),
|
||||||
)
|
)
|
||||||
|
|
|
@ -35,7 +35,7 @@ install_requires =
|
||||||
Flask-SQLAlchemy>=2.4,<3
|
Flask-SQLAlchemy>=2.4,<3
|
||||||
Flask-Talisman>=0.8,<1
|
Flask-Talisman>=0.8,<1
|
||||||
Flask-WTF>=0.14.3,<2
|
Flask-WTF>=0.14.3,<2
|
||||||
WTForms>=2.3.1,<2.4
|
WTForms>=2.3.1,<3.1
|
||||||
Flask>=2,<3
|
Flask>=2,<3
|
||||||
itsdangerous>=2,<3
|
itsdangerous>=2,<3
|
||||||
Jinja2>=3,<4
|
Jinja2>=3,<4
|
||||||
|
|
Loading…
Reference in a new issue