I'm trying to check input type of widget as below:
for field in form:
if field.field.widget.input_type == 'checkbox':
do_smth()
else:
do_smth_else()
but it seems Django Textarea widget does not have attribute "input_type".
I already solved the problem by wrapping input_type check in try/except block:
try:
input_type = field.field.widget.input_type
except AttributeError:
input_type = 'textarea'
but I have 2 questions:
1) Why only this widget does not have "input_type", and others have?
2) Is there a better way to solve the problem above?
I'm sorry for my English and thank you for advance!