S
I was about two days running behind these answers, I did mirabolizing things in my code to try to solve this problem, and in the end find out that it is something super simple, just put the following line in the builder:self.required_css_class = 'control-label is-visible'
Then all the classes you assign to "required_css_class" is rendered in the label, follow below the full class:from django import forms
class FormDefault(forms.Form):
def init(self, *args, **kwargs):
super(FormDefault, self).init(*args, **kwargs)
self.required_css_class = 'control-label is-visible'
for field_name, field in self.fields.items():
field.widget.attrs['class'] = 'form-control'
def renderFormGroup(self):
return self._html_output(
normal_row='<div class="form-group form-group-material" %(html_class_attr)s>%(label)s %(field)s%(help_text)s</div>',
error_row='%s',
row_ender='</div>',
help_text_html=' <span class="helptext">%s</span>',
errors_on_separate_row=True)