diff options
-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 |