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

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -