How to add Bootrsap icons to Flask-Nav navbar

1.2k views Asked by At

I am using Flask-Bootrsap/ Flask-Nav support to generate a navbar for my webapp. I have some issues trying to style it. I would like to add bootrsap or font/awesome icons but i don't know how to do it directly from my rendered.

Nav.py

@nav.navigation()
def mynavbar():
    return Navbar(
        'mysite',
        View('View Historic', 'Link1'),
        View('New users', 'Link2'),
        View('New users', 'Link3'),
        View('Upload file', 'Link4'),
        View('Packages', 'Link5'),
    )

Base.html

{% block navbar %}
    {{nav.mynavbar.render()}}
{% endblock %}
1

There are 1 answers

1
John Connor On

Currently there isn't a way through the main branch.

See: https://github.com/mbr/flask-nav/pull/5 https://github.com/mbr/flask-bootstrap/pull/125

Someone made a branch for both Flask-Nav and Flask-Bootstrap to embed an img tag in the View link.

However, for some reason, the owner has yet to merge the pull request; his cited excuses seem asinine imo.

I'd recommend either using: https://github.com/nypgand1/flask-nav/tree/feature-ViewImg

or making equivalent modifications for your own usage as the owner seems to not care.