Style with Black

This commit is contained in:
Michał Gdula 2023-05-16 18:01:59 +03:00
parent 27bf6f64ef
commit 7b86a6b6bb
3 changed files with 25 additions and 15 deletions

View file

@ -10,11 +10,15 @@ from website.config import INSTANCE_DIR, MIGRATION_DIR
class LoginForm(FlaskForm):
uuid = StringField('uuid', validators=[DataRequired()], render_kw={"placeholder": "12345678-ABCD-ABCD-ABCD-123456789EFG"})
uuid = StringField(
"uuid",
validators=[DataRequired()],
render_kw={"placeholder": "12345678-ABCD-ABCD-ABCD-123456789EFG"},
)
app = Flask(__name__, instance_path=INSTANCE_DIR)
app.config.from_pyfile('config.py')
app.config.from_pyfile("config.py")
db.init_app(app)
migrate.init_app(app, db, directory=MIGRATION_DIR)
@ -22,10 +26,15 @@ with app.app_context():
db.create_all()
assets.init_app(app)
styles = Bundle('sass/styles.sass', filters='libsass, cssmin', output='gen/packed.css', depends='sass/*.sass')
assets.register('styles', styles)
scripts = Bundle('js/*.js', filters='jsmin', output='gen/packed.js')
assets.register('scripts', scripts)
styles = Bundle(
"sass/styles.sass",
filters="libsass, cssmin",
output="gen/packed.css",
depends="sass/*.sass",
)
assets.register("styles", styles)
scripts = Bundle("js/*.js", filters="jsmin", output="gen/packed.js")
assets.register("scripts", scripts)
@login_manager.user_loader
@ -33,12 +42,12 @@ def load_user(user_id):
return Users.get(user_id)
@app.route('/')
@app.route("/")
def index():
return render_template('index.html')
return render_template("index.html")
@app.route('/login', methods=["GET", "POST"])
@app.route("/login", methods=["GET", "POST"])
def login():
form = LoginForm()
@ -49,4 +58,4 @@ def login():
else:
flash("Inncorrect login")
return render_template('login.html', form=form)
return render_template("login.html", form=form)

View file

@ -1,5 +1,6 @@
import os
# Purely to make the code a bit more readable
def env(key):
return os.getenv(key)
@ -7,7 +8,7 @@ def env(key):
SECRET_KEY = env("FLASK_KEY")
SQLALCHEMY_DATABASE_URI = 'sqlite:///site.db'
SQLALCHEMY_DATABASE_URI = "sqlite:///site.db"
MIGRATION_DIR = "/data/storage/migrations"
INSTANCE_DIR = "/data/storage/instance"

View file

@ -19,20 +19,20 @@ class Games(db.Model):
class Images(db.Model):
id = db.Column(db.Integer, primary_key=True)
image = db.Column(db.String, nullable=False)
game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
game_id = db.Column(db.Integer, db.ForeignKey("games.id"))
class Tags(db.Model):
id = db.Column(db.Integer, primary_key=True)
tag = db.Column(db.String, nullable=False)
game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
game_id = db.Column(db.Integer, db.ForeignKey("games.id"))
class Authors(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, nullable=False)
role = db.Column(db.String, nullable=False, default='Developer')
game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
role = db.Column(db.String, nullable=False, default="Developer")
game_id = db.Column(db.Integer, db.ForeignKey("games.id"))
class Users(db.Model, UserMixin):