Fixes squiggle lines

This commit is contained in:
2025-04-15 11:26:59 +02:00
parent 67208a513e
commit ae67d53c5e
4 changed files with 14 additions and 4 deletions

2
app.py
View File

@@ -1,6 +1,6 @@
from application import app
from flask import redirect, url_for
from flask_login import current_user, login_required # type: ignore
from flask_login import login_required # type: ignore
# home route

View File

@@ -7,3 +7,8 @@ class User(db.Model, UserMixin):
username = db.Column(db.String(150), unique=True, nullable=False)
password = db.Column(db.String(150), nullable=False)
is_admin = db.Column(db.Boolean, default=False)
def __init__(self, username: str, password: str, is_admin: bool = False):
self.username = username
self.password = password
self.is_admin = is_admin

View File

@@ -5,3 +5,7 @@ class Service(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, nullable=False)
url = db.Column(db.String, nullable=False)
def __init__(self, name: str, url: str):
self.name = name
self.url = url

View File

@@ -1,11 +1,12 @@
from flask_login import current_user
from typing import Callable, Any
from flask_login import current_user # type: ignore
from functools import wraps
from flask import redirect, url_for, flash
def admin_required(f):
def admin_required(f: Callable[..., Any]) -> Callable[..., Any]:
@wraps(f)
def decorated_function(*args, **kwargs):
def decorated_function(*args: ..., **kwargs: ...):
if not current_user.is_authenticated:
return redirect(url_for("login"))
if not current_user.is_admin: