From 9f336bbde2c228dd8e493a3820c0787c6f880b25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Mon, 25 Aug 2014 22:55:30 +0200 Subject: Port for WTForms2 (partially) --- app/forms.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/app/forms.py b/app/forms.py index 250bc21..0bbb745 100644 --- a/app/forms.py +++ b/app/forms.py @@ -2,10 +2,9 @@ import flask from flask.ext.wtf import Form as _Form from wtforms.fields import BooleanField, DateField, IntegerField, StringField, HiddenField, PasswordField -from wtforms import fields, validators, ValidationError +from wtforms import fields, validators, ValidationError, Form as WTForm from wtforms.ext.sqlalchemy.fields import QuerySelectField -from wtforms.ext.i18n.form import Form as i18nForm from . import app @@ -21,9 +20,9 @@ class DecimalField(fields.DecimalField): req = [validators.input_required()] -class Form(_Form, i18nForm): - # docs say LOCALES, code says LANGUAGES ... use both :) - LANGUAGES = LOCALES = ['de_DE', 'de'] +class Form(_Form): + class Meta: + locales = ['de_DE', 'de'] def __init__ (self, *args, **kwargs): self._msg = kwargs.pop('flash', u"Fehler im Formular!") @@ -46,4 +45,4 @@ class Form(_Form, i18nForm): # use WTForms builtin translation support instead of the flask-babael # stuff added by flask-wtf # FIXME: remove this, if flask-babel is used in the app - return i18nForm._get_translations(self) + return WTForm._get_translations(self) -- cgit v1.2.3