Reputation: 183
I would like to have something in forms.py like:
class myForm(forms.Form):
a = forms.IntegerField()
b = forms.CharField(label="my image.jpg
here")
And in html source code it should looks like:
<label
for="test"><img src="{% static "images/image.jpg"
%}"></label>
Is that possible?
Regards,
yang
Upvotes: 1
Views: 429
Reputation: 1
I think you have a few options...
You could set your label to label="" (Untested, unsure if it would work... might consider using {}.format to get your string set).
Redefine a built in method for displaying the label. You could modify as_p(), as_ul(), etc or redefine label_tag(). The source code is here where you can investigate. I think redefining label_tag is your best choice.
Upvotes: 0