Skip to content

Commit

Permalink
Allow form.widgets.RenderTemplateWidget to use the theme object
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmayo committed Oct 3, 2024
1 parent ca33133 commit 404d828
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions flask_admin/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,8 @@ def __init__(self, app=None, name=None,
# Register with application
if app is not None:
self._init_extension()
# Make theme available via current_app
app.config['theme'] = self.theme

def _validate_admin_host_and_subdomain(self):
if self.subdomain is not None and self.host is not None:
Expand Down
1 change: 1 addition & 0 deletions flask_admin/form/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def __call__(self, field, **kwargs):
'_gettext': gettext,
'_ngettext': ngettext,
'h': h,
'theme': current_app.config['theme'],
})

template = current_app.jinja_env.get_template(self.template)
Expand Down

0 comments on commit 404d828

Please sign in to comment.