Commit cd25c6fc authored by Artem Serga's avatar Artem Serga

#6 - Extra place to pass helpers to template

parent 2e794e94
import time
import datetime
from wtforms import fields, widgets
from flask.globals import _request_ctx_stack
from flask.ext import wtf
from wtforms import fields, widgets
from flask.ext.admin.babel import gettext, ngettext
from flask.ext.admin import helpers as h
class BaseForm(wtf.Form):
......@@ -153,7 +152,9 @@ class RenderTemplateWidget(object):
kwargs.update({
'field': field,
'_gettext': gettext,
'_ngettext': ngettext})
'_ngettext': ngettext,
'h': h,
})
template = jinja_env.get_template(self.template)
return template.render(kwargs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment