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

menu with category_icon_classes bug #1800

Open
fordguo opened this issue Jan 25, 2019 · 1 comment
Open

menu with category_icon_classes bug #1800

fordguo opened this issue Jan 25, 2019 · 1 comment

Comments

@fordguo
Copy link

fordguo commented Jan 25, 2019

`
category_icon_classes = {"System": "glyphicon glyphicon-wrench"}

admin = Admin(
template_mode="bootstrap3",
category_icon_classes=category_icon_classes)`
screen shot 2019-01-25 at 5 21 02 pm

The related code is:

<li class="dropdown{% if class_name %} {{class_name}}{% endif %}">

@fwiersENO
Copy link

Work-around I use for 1.5.3:

from flask_babelex import lazy_gettext
from flask_admin.consts import ICON_TYPE_GLYPH

def add_views():
	mycat = lazy_gettext('My Category')
	admin.add_view(MyAdminView(... , category=mycat, ...)
	...
	# ONLY set icon for category AFTER adding a menu-item to the category.
	for item in admin.menu():
		if item.is_category():
			if item.name == mycat:
				item.icon_type = ICON_TYPE_GLYPH
				item.icon_value = "glyphicon-wrench"
				break

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

2 participants