I've created a custom template for rendering form fields:
<tr class="{{field.field.widget.attrs.class}}">
<th class="label">
<label for="{{field.auto_id}}">
{{field.label}}
{% if not field.field.required %}<span class="optional">(optional)</span>{% endif %}
</label>
</th>
<td class="field">
{{field}}
{% if field.errors %}<label class="error" for="{{field.auto_id}}">{{field.errors.0}}</label>{% endif %}
{% if field.help_text %}<small class="help-text">{{field.help_text}}</small>{% endif %}
</td>
</tr>
But I want to check if the widget is a checkbox, and if so, render it differently. How can I do that in the template?