We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
BootstrapRadioCheckboxDecorator
As is, it escapes the input field and writes it as part of the label string.
This snippet fixes it for me: wtforms_widgets/widgets.py
class BootstrapRadioCheckboxDecorator(WidgetDecorator): """ Renders a field in horizontal layout. Horizontal layout is a two column layout, where the label is placed in the left column and the field is placed right next to it. """ wrapper_class = None def _render(self, field, **kwargs): return HTMLString(u''.join([ u'<div class="', self.wrapper_class, u'">', u'<label class="', self.wrapper_class + "-label", u'">', self.widget(field, class_=self.wrapper_class + "-input", **kwargs), escape(field.label.text), u'</label>', u'</div>', ])) def render_basic(self, field, **kwargs): return self._render(field, **kwargs) def render_horizontal(self, field, **kwargs): return HTMLString(u''.join([ u'<div class="offset-sm-4 col-sm-4">', self._render(field, **kwargs), u'</div>', ])) def render_inline(self, field, **kwargs): return HTMLString(u''.join([ u'<div class="', self.wrapper_class + "-inline", u'">', u'<label class="', self.wrapper_class + "-label", u'">', self.widget(field, class_=self.wrapper_class + "-input", **kwargs), escape(field.label.text), u'</label>', u'</div>', ])) def __call__(self, field, **kwargs): render_mode = kwargs.pop("render_mode", "basic") if render_mode == "basic": return self.render_basic(field, **kwargs) elif render_mode == "horizontal": return self.render_horizontal(field, **kwargs) elif render_mode == "inline": return self.render_inline(field, **kwargs) else: raise ValueError("Unknown render mode: {0}".format(render_mode)) class BootstrapRadioDecorator(BootstrapRadioCheckboxDecorator): wrapper_class = u"form-check" class BootstrapCheckboxDecorator(BootstrapRadioCheckboxDecorator): wrapper_class = u"form-check"
I'll try to make a PR in the near future. Thanks for the awesome library.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
As is, it escapes the input field and writes it as part of the label string.
This snippet fixes it for me:
wtforms_widgets/widgets.py
I'll try to make a PR in the near future. Thanks for the awesome library.
The text was updated successfully, but these errors were encountered: