version_app
This commit is contained in:
22
app.py
22
app.py
@@ -25,6 +25,15 @@ except ImportError:
|
|||||||
from backports.zoneinfo import ZoneInfo
|
from backports.zoneinfo import ZoneInfo
|
||||||
|
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
# Ładujemy konfigurację z pliku config.py
|
||||||
|
app.config.from_object("config.Config")
|
||||||
|
|
||||||
|
db = SQLAlchemy(app)
|
||||||
|
login_manager = LoginManager(app)
|
||||||
|
login_manager.login_view = "zaloguj"
|
||||||
|
LOCAL_TZ = ZoneInfo("Europe/Warsaw")
|
||||||
|
|
||||||
def read_commit_and_date(filename="version.txt", root_path=None):
|
def read_commit_and_date(filename="version.txt", root_path=None):
|
||||||
base = root_path or os.path.dirname(os.path.abspath(__file__))
|
base = root_path or os.path.dirname(os.path.abspath(__file__))
|
||||||
path = os.path.join(base, filename)
|
path = os.path.join(base, filename)
|
||||||
@@ -55,15 +64,6 @@ if not commit:
|
|||||||
APP_VERSION = f"{deploy_date}+{commit}"
|
APP_VERSION = f"{deploy_date}+{commit}"
|
||||||
app.config["APP_VERSION"] = APP_VERSION
|
app.config["APP_VERSION"] = APP_VERSION
|
||||||
|
|
||||||
# Ładujemy konfigurację z pliku config.py
|
|
||||||
app.config.from_object("config.Config")
|
|
||||||
|
|
||||||
db = SQLAlchemy(app)
|
|
||||||
login_manager = LoginManager(app)
|
|
||||||
login_manager.login_view = "zaloguj"
|
|
||||||
LOCAL_TZ = ZoneInfo("Europe/Warsaw")
|
|
||||||
|
|
||||||
|
|
||||||
# MODELE
|
# MODELE
|
||||||
class User(UserMixin, db.Model):
|
class User(UserMixin, db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
@@ -534,8 +534,8 @@ def dodaj_wplate(zbiorka_id):
|
|||||||
flash("Brak uprawnień", "danger")
|
flash("Brak uprawnień", "danger")
|
||||||
return redirect(url_for("index"))
|
return redirect(url_for("index"))
|
||||||
|
|
||||||
zb = db.session.get(Zbiorka, zbiorka_id) if is_edit else None
|
zb = db.session.get(Zbiorka, zbiorka_id)
|
||||||
if is_edit and not zb:
|
if not zb:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
|
Reference in New Issue
Block a user