From 428ff4392946d30992751991b8036e91e12f0336 Mon Sep 17 00:00:00 2001 From: aleanza Date: Tue, 31 Dec 2019 17:17:15 +0100 Subject: [PATCH 1/2] VS Code configuration --- flask/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/flask/.gitignore b/flask/.gitignore index 602cadfa8..7dbd26bd7 100644 --- a/flask/.gitignore +++ b/flask/.gitignore @@ -1,3 +1,4 @@ *.pyc venv local_db +.vscode \ No newline at end of file From 36471ac0304ab31ef4503d2f5efc2c359ff37a5d Mon Sep 17 00:00:00 2001 From: aleanza Date: Tue, 31 Dec 2019 17:18:52 +0100 Subject: [PATCH 2/2] Port to Python 3 --- flask/notejam/__init__.py | 6 +++--- flask/notejam/forms.py | 20 ++++++++++---------- flask/notejam/models.py | 2 +- flask/notejam/templates/base.html | 2 +- flask/notejam/views.py | 10 +++++----- flask/requirements.txt | 17 ++++++++--------- 6 files changed, 28 insertions(+), 29 deletions(-) diff --git a/flask/notejam/__init__.py b/flask/notejam/__init__.py index 733f727e0..ceec080a2 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, diff --git a/flask/notejam/forms.py b/flask/notejam/forms.py index 1dc839622..8bf9d8454 100644 --- a/flask/notejam/forms.py +++ b/flask/notejam/forms.py @@ -1,16 +1,16 @@ -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 TextField, PasswordField, SelectField, TextAreaField +from wtforms.validators import Required, Email, EqualTo, ValidationError from notejam.models import User, Pad -class SigninForm(Form): +class SigninForm(FlaskForm): email = TextField('Email', validators=[Required(), Email()]) password = PasswordField('Password', validators=[Required()]) -class SignupForm(Form): +class SignupForm(FlaskForm): email = TextField('Email', validators=[Required(), Email()]) password = PasswordField('Password', validators=[Required()]) repeat_password = PasswordField( @@ -29,7 +29,7 @@ def validate_email(self, field): ) -class NoteForm(Form): +class NoteForm(FlaskForm): name = TextField('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): +class PadForm(FlaskForm): name = TextField('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,7 +74,7 @@ def validate_old_password(self, field): ) -class ForgotPasswordForm(Form): +class ForgotPasswordForm(FlaskForm): email = TextField('Email', validators=[Required(), Email()]) def validate_email(self, field): 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 @@