diff --git a/flask/notejam/__init__.py b/flask/notejam/__init__.py index 733f727e0..c48043d8e 100644 --- a/flask/notejam/__init__.py +++ b/flask/notejam/__init__.py @@ -1,7 +1,7 @@ from flask import Flask -from flask.ext.sqlalchemy import SQLAlchemy -from flask.ext.login import LoginManager -from flask.ext.mail import Mail +from flask_sqlalchemy import SQLAlchemy +from flask_login import LoginManager +from flask_mail import Mail from notejam.config import ( Config, DevelopmentConfig, @@ -17,6 +17,7 @@ # @TODO use application factory approach app = Flask(__name__) app.config.from_object(from_env[os.environ.get('ENVIRONMENT', 'testing')]) +app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False db = SQLAlchemy(app) diff --git a/flask/notejam/forms.py b/flask/notejam/forms.py index 1dc839622..6b13bc53a 100644 --- a/flask/notejam/forms.py +++ b/flask/notejam/forms.py @@ -1,17 +1,17 @@ -from flask.ext.wtf import (Form, TextField, PasswordField, -SelectField, TextAreaField) -from flask.ext.wtf import Required, Email, EqualTo, ValidationError +from flask_wtf import FlaskForm +from wtforms import StringField, PasswordField, SelectField, TextAreaField +from wtforms.validators import Required, Email, EqualTo, ValidationError from notejam.models import User, Pad -class SigninForm(Form): - email = TextField('Email', validators=[Required(), Email()]) +class SigninForm(FlaskForm): + email = StringField('Email', validators=[Required(), Email()]) password = PasswordField('Password', validators=[Required()]) -class SignupForm(Form): - email = TextField('Email', validators=[Required(), Email()]) +class SignupForm(FlaskForm): + email = StringField('Email', validators=[Required(), Email()]) password = PasswordField('Password', validators=[Required()]) repeat_password = PasswordField( 'Repeat Password', @@ -29,8 +29,8 @@ def validate_email(self, field): ) -class NoteForm(Form): - name = TextField('Name', validators=[Required()]) +class NoteForm(FlaskForm): + name = StringField('Name', validators=[Required()]) text = TextAreaField('Note', validators=[Required()]) pad = SelectField('Pad', choices=[], coerce=int) @@ -42,16 +42,16 @@ def __init__(self, user=None, **kwargs): ] -class PadForm(Form): - name = TextField('Name', validators=[Required()]) +class PadForm(FlaskForm): + name = StringField('Name', validators=[Required()]) # dummy form -class DeleteForm(Form): +class DeleteForm(FlaskForm): pass -class ChangePasswordForm(Form): +class ChangePasswordForm(FlaskForm): old_password = PasswordField('Old Password', validators=[Required()]) new_password = PasswordField('New Password', validators=[Required()]) repeat_new_password = PasswordField( @@ -74,8 +74,8 @@ def validate_old_password(self, field): ) -class ForgotPasswordForm(Form): - email = TextField('Email', validators=[Required(), Email()]) +class ForgotPasswordForm(FlaskForm): + email = StringField('Email', validators=[Required(), Email()]) def validate_email(self, field): if not User.query.filter_by(email=field.data).count(): diff --git a/flask/notejam/models.py b/flask/notejam/models.py index 3bd36d401..fa717ffba 100755 --- a/flask/notejam/models.py +++ b/flask/notejam/models.py @@ -2,7 +2,7 @@ from werkzeug.security import (generate_password_hash, check_password_hash) -from flask.ext.login import UserMixin +from flask_login import UserMixin from notejam import db diff --git a/flask/notejam/templates/base.html b/flask/notejam/templates/base.html index f20662fb9..5a061688b 100644 --- a/flask/notejam/templates/base.html +++ b/flask/notejam/templates/base.html @@ -35,7 +35,7 @@