Skip to content

Commit 404d828

Browse files
committed
Allow form.widgets.RenderTemplateWidget to use the theme object
1 parent ca33133 commit 404d828

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

flask_admin/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,8 @@ def __init__(self, app=None, name=None,
548548
# Register with application
549549
if app is not None:
550550
self._init_extension()
551+
# Make theme available via current_app
552+
app.config['theme'] = self.theme
551553

552554
def _validate_admin_host_and_subdomain(self):
553555
if self.subdomain is not None and self.host is not None:

flask_admin/form/widgets.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def __call__(self, field, **kwargs):
9090
'_gettext': gettext,
9191
'_ngettext': ngettext,
9292
'h': h,
93+
'theme': current_app.config['theme'],
9394
})
9495

9596
template = current_app.jinja_env.get_template(self.template)

0 commit comments

Comments
 (0)