Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use the flask-admin template outside of the admin views #12

Open
jdejoode opened this issue Oct 18, 2015 · 3 comments
Open

How to use the flask-admin template outside of the admin views #12

jdejoode opened this issue Oct 18, 2015 · 3 comments

Comments

@jdejoode
Copy link

I want my login and register pages to have the same layout as the admin pages, but I always get the infamous errors showing that 'admin_base_template' is undefined.

How can I accomplish this (DRY)?

@ypopivniak
Copy link

You have to extends from admin/base.html. In example, for Flask-Security you can do this:

{% extends 'admin/base.html' %}

{% block access_control %}
{% if current_user.is_authenticated %}
<div class="navbar-text btn-group pull-right">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
        <i class="glyphicon glyphicon-user"></i>
        {% if current_user.name -%}
        {{ current_user.name }}
        {% else -%}
        {{ current_user.email }}
        {%- endif %}<span class="caret"></span></a>
    <ul class="dropdown-menu" role="menu">
        <li><a href="{{ url_for_security('change_password') }}">Change password</a></li>
        <li><a href="{{ url_for_security('logout') }}">Log out</a></li>
    </ul>
</div>
{% endif %}
{% endblock %}

and your template will have same layout.

@nyaboke-nyaribo
Copy link

I'm getting the same error. What was your solution?

@jdejoode
Copy link
Author

It's been a while. I think that overwriting admin/templates/admin/base.html did it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants