From fce0869042065365d40ebb9f3093e477cc71df91 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Fri, 18 Jun 2021 20:03:24 +0000 Subject: admin page, and link to admin page --- apioforum/__init__.py | 3 +++ apioforum/permissions.py | 2 ++ apioforum/templates/base.html | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/apioforum/__init__.py b/apioforum/__init__.py index 02252de..4283796 100644 --- a/apioforum/__init__.py +++ b/apioforum/__init__.py @@ -31,6 +31,9 @@ def create_app(): from . import thread app.register_blueprint(thread.bp) + from . import admin + app.register_blueprint(admin.bp) + from .fuzzy import fuzzy app.jinja_env.filters['fuzzy']=fuzzy diff --git a/apioforum/permissions.py b/apioforum/permissions.py index 4a9cf97..816936c 100644 --- a/apioforum/permissions.py +++ b/apioforum/permissions.py @@ -38,4 +38,6 @@ def make_admin(username): def init_app(app): app.cli.add_command(make_admin) + app.context_processor(lambda: dict(is_admin=is_admin())) + diff --git a/apioforum/templates/base.html b/apioforum/templates/base.html index 5121b85..aae49e3 100644 --- a/apioforum/templates/base.html +++ b/apioforum/templates/base.html @@ -20,6 +20,11 @@ {% if g.user %}

{{ g.user }}

+ + {% if is_admin %} +

admin

+ {% endif %} +

logout -- cgit v1.2.3