This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import subprocess | |
| from datetime import date | |
| def main(): | |
| help = "detalha os commits do dia" | |
| print("### %s ###" % help) | |
| author = input('Git username: ') | |
| cwd = input('Project source: ') | |
| command = f'cd {cwd} && git log --pretty=format:"%s" --author="{author}" --since="6am"' | |
| raw_last_commits = subprocess.check_output(command, shell=True).decode('utf-8').strip() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| @app.route('/logout') | |
| def logout(): | |
| logout_user() | |
| return redirect(url_for('login')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| @app.route("/") | |
| @login_required | |
| def index(): | |
| return render_template('index.html') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| @app.route("/login", methods=["GET", "POST"]) | |
| def login(): | |
| form = LoginForm() | |
| username = form.username.data | |
| password = form.password.data | |
| if form.validate_on_submit(): | |
| user = User.query.filter_by(username=username).first() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| @app.route('/register', methods=['GET', 'POST']) | |
| def register(): | |
| form = RegisterForm() | |
| username = form.username.data | |
| password = form.password.data | |
| name = form.name.data | |
| email = form.email.data | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from app import db, login_manager | |
| from flask_login import UserMixin | |
| from werkzeug.security import generate_password_hash, check_password_hash | |
| @login_manager.user_loader | |
| def get_user(user_id): | |
| return User.query.get(user_id) | |
| class User(db.Model, UserMixin): | |
| __tablename__ = 'users' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask_wtf import FlaskForm | |
| from wtforms import StringField, PasswordField, BooleanField | |
| from wtforms.validators import DataRequired, Email | |
| class LoginForm(FlaskForm): | |
| username = StringField("username", validators=[DataRequired()]) | |
| password = PasswordField("password", validators=[DataRequired()]) | |
| remember_me = BooleanField() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask | |
| from flask_sqlalchemy import SQLAlchemy | |
| from flask_script import Manager | |
| from flask_migrate import Migrate, MigrateCommand | |
| from flask_login import LoginManager | |
| app = Flask(__name__) | |
| app.config.from_object('config') | |
| login_manager = LoginManager(app) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from apps.usuario.views import ObtainToken | |
| urlpatterns = [ | |
| # adicional urls... | |
| path('token/api/', ObtainToken.as_view(), name='token_obtain'), | |
| ] |
NewerOlder