Django override the form HTML label template? -
in settings.py have set
form_renderer = 'django.forms.renderers.templatessetting'
now in can add own templates in:
<project>/templates/django/forms/widgets/
or
<app>/templates/django/forms/widgets/
this works great! however, can't find override default html (form) label?
class testform(forms.form): first_name = forms.charfield(label="first name", max_length=50) last_name = forms.charfield(label="last name") nick_name = forms.charfield(required=false)
the above form render labels this:
<label for="id_first_name">first name:</label>
i want render label differently. so, thought easy adding html label template: templates/django/forms/widgets/label.html
this doesn't work. going through django docs, can't find how labels. apparently label not widget.
https://docs.djangoproject.com/en/1.11/ref/forms/widgets/#built-in-widgets
my question, where/how change default label?
Comments
Post a Comment