I was trying include a checkbox on my template, but it showed me some text on the browser instead.
I have a form (forms.py) that contains boolean field, e.g:
Class MyForm(forms.Form):
my_checkbox = forms.BooleanField(required=False, label='my_checkbox')
and I have the following in my templates/my_app/my_form_template.py:
<form id="form" method="post">
<form>
In the browser after running the server, I've got: (<django.forms.fields.BooleanField object at 0x0000014BE3CF9208>,)
The CharField and ChoiceField work perfectly except BooleanField. What is a way to represent a checkbox on the template?
I've tried in the template and it shows the checkbox, but I wish to custom the attributes of the checkbox.
Aucun commentaire:
Enregistrer un commentaire