Home > database >  Don't render abel for id in django form
Don't render abel for id in django form

Time:11-21

Is it possible not to render the for attribute of a label?

I want <label>Text</label> instead of <label for="id_i">Text</label> ?

CodePudding user response:

you will need to manually render the form field: <label>{{field.label}}</label> will render the label as you require. See the docs for how to manually render form fields: https://docs.djangoproject.com/en/dev/topics/forms/#looping-over-the-form-s-fields

CodePudding user response:

I more flexible solution is to override id_for_label in a widget.

  • Related