Changes between Initial Version and Version 2 of Ticket #29153


Ignore:
Timestamp:
Feb 23, 2018, 10:51:38 AM (7 years ago)
Author:
Christoph
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29153 – Description

    initial v2  
     1Goal:
     2Add attributes like "class" to the label tag for inputs.
     3
     4Problem:
     5Actually the only thing thats stops me from using {{ form }} is the incapability to change classes for labels easily. So i have to do it like this, for every form and every field:
     6
     7{{{
     8{{ form.non_field_errors }}
     9<div class="fieldWrapper">
     10    {{ form.subject.errors }}
     11    <label for="{{ form.subject.id_for_label }}" class="MY-CUSTOM-CLASS">Email subject:</label>
     12    {{ form.subject }}
     13</div>
     14
     15}}}
     16
     17Where it should be changed:
     18I would be fine if the label_attrs could be set in BaseForm(), but i think the right place would be class Field
     19
    120As the label_tag is already set up to give the label class attributes and label_suffix, it is quite easy to add this to the BaseForm _html_output()
    221
Back to Top