From 6e50f9ad7451428028799925c2b4cf1b805ec47b Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Mon, 25 Sep 2023 16:50:54 +0100 Subject: [PATCH 1/2] Read DB URL from config. --- add_place.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/add_place.py b/add_place.py index 41060d6..61d0b92 100755 --- a/add_place.py +++ b/add_place.py @@ -1,12 +1,12 @@ #!/usr/bin/python3 +from main import app import sys - from confarchive import database, model, wikidata -DB_URL = "postgresql:///confarchive" -database.init_db(DB_URL) +app.config.from_object("config.default") +database.init_app(app) def add_country(name: str) -> None: From 99b180681ffa326bd98422e8902477c7e2c11ca0 Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Mon, 25 Sep 2023 16:51:29 +0100 Subject: [PATCH 2/2] Allow admin to access speaker merge --- main.py | 4 +++- templates/search_people.html | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 63c3f1f..f1e5990 100755 --- a/main.py +++ b/main.py @@ -156,7 +156,9 @@ def search_people() -> str: q = model.Person.query.filter(model.Person.name.ilike(f"%{search_for}%")).order_by( model.Person.name ) - return flask.render_template("search_people.html", q=q, search_for=search_for) + return flask.render_template( + "search_people.html", q=q, search_for=search_for, is_admin=check_admin_mode + ) @app.route("/merge", methods=["GET", "POST"]) diff --git a/templates/search_people.html b/templates/search_people.html index aabe7fe..c2017de 100644 --- a/templates/search_people.html +++ b/templates/search_people.html @@ -20,7 +20,7 @@ {% set count = q.count() %} Found {{ count }} people matching '{{ search_for }}' - {% if config.ADMIN_MODE and count %} + {% if is_admin() and count %} merge {% endif %}