I must present the required and error attributes as part of the markup spit by field in the template. I know that this form can be done using .as_p, etc. When the layout is automatically generated.
I have complex 2 column layouts for the form. Is it possible to include required_css_class = 'required' , which is used for formatting html for different fields Is part of the square? I need to do this because I want to do jquery drives verification with HTML generated without doing too much extra work. thanks This is not a part of regular widget rendering. You can use the same Alternatively, there is a way to hack an error class in errated areas: forms> in the desired css_class .BoundField.css_classes and
forms.BaseForm._html_output appears to be in use only for
as_p ,
as_table , And such.
css_classes method to return the classes of your elements, so I think the easiest solution is to
& lt; Input & gt; with one element and that class
{{field.css_classes}} , and modify your verification selector.
def __init __ (auto, * args, ** kwargs ): For super.errors in the super (form, self) .__ init __ (* args, ** kwargs) area: if not field == '__all__': # sign for errors can be __all__ for non field errors is. Self. Field [field] Visit. Editors ['Class'] = \ Selffield [Field]. Widet.ATR To use the required code ("class", "") + 'error'
needed_css_class , you can use the
bound field query_class method , Which is made on the demand of the bound form since the base form
__getitem __ and
__ iter __ . The above method is easy.
Comments
Post a Comment