Skip to content

Commit 09f17f3

Browse files
authored
Merge pull request #134 from cengizhancam/master
ThinkTank
2 parents d1aee28 + 30d9baa commit 09f17f3

23 files changed

+913
-0
lines changed

Projects/ThinkTank/app.db

32 KB
Binary file not shown.

Projects/ThinkTank/app/__init__.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from flask import Flask
2+
from flask_sqlalchemy import SQLAlchemy
3+
from flask_migrate import Migrate
4+
from flask_wtf.csrf import CSRFProtect
5+
from flask_bcrypt import Bcrypt
6+
from flask_login import LoginManager
7+
8+
app = Flask(__name__)
9+
app.config.from_object('config.Config')
10+
11+
csrf = CSRFProtect(app)
12+
bcrypt = Bcrypt(app)
13+
db = SQLAlchemy(app)
14+
migrate = Migrate(app, db)
15+
16+
login_manager = LoginManager(app)
17+
login_manager.login_view = 'login'
18+
login_manager.login_message_category = 'info'
19+
20+
from app.models import User
21+
22+
@login_manager.user_loader
23+
def load_user(user_id):
24+
return User.query.get(int(user_id))
25+
26+
from app import routes, models, forms
1.42 KB
Binary file not shown.
690 Bytes
Binary file not shown.
2.33 KB
Binary file not shown.
2.96 KB
Binary file not shown.
1.67 KB
Binary file not shown.
10.3 KB
Binary file not shown.
2.49 KB
Binary file not shown.

Projects/ThinkTank/app/forms.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from flask_wtf import FlaskForm
2+
from wtforms import StringField, TextAreaField, PasswordField, SubmitField
3+
from wtforms.validators import DataRequired, Length, Email, EqualTo
4+
5+
class RegistrationForm(FlaskForm):
6+
email = StringField('Email', validators=[DataRequired(), Email()])
7+
username = StringField('Username', validators=[DataRequired(), Length(min=2, max=64)])
8+
password = PasswordField('Password', validators=[DataRequired(), Length(min=6)])
9+
confirm_password = PasswordField('Confirm Password', validators=[DataRequired(), EqualTo('password')])
10+
submit = SubmitField('Sign Up')
11+
12+
class LoginForm(FlaskForm):
13+
email = StringField('Email', validators=[DataRequired(), Email()])
14+
password = PasswordField('Password', validators=[DataRequired()])
15+
submit = SubmitField('Login')
16+
17+
class PageForm(FlaskForm):
18+
title = StringField('Title', validators=[DataRequired(), Length(max=128)])
19+
content = TextAreaField('Content', validators=[DataRequired()])
20+
submit = SubmitField('Save')

0 commit comments

Comments
 (0)