diff options
author | ubq323 <ubq323> | 2021-06-18 20:03:24 +0000 |
---|---|---|
committer | ubq323 <ubq323> | 2021-06-18 20:03:24 +0000 |
commit | fce0869042065365d40ebb9f3093e477cc71df91 (patch) | |
tree | 16a6ebb63dc99c75d472c23a769931806f65fe36 | |
parent | d92a07381f0226dd4aa4f5dc63c11e77853634e0 (diff) |
admin page, and link to admin page
-rw-r--r-- | apioforum/__init__.py | 3 | ||||
-rw-r--r-- | apioforum/permissions.py | 2 | ||||
-rw-r--r-- | apioforum/templates/base.html | 5 |
3 files changed, 10 insertions, 0 deletions
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 %} <p>{{ g.user }}</p> + + {% if is_admin %} + <p><a href="{{url_for('admin.adminpage')}}">admin</a></p> + {% endif %} + <p> <a href="{{ url_for('auth.logout',next=path_for_next) }}"> logout |