I’d like to get community feedback on whether it would be desirable to anyone else to add an input_type attribute to the Textarea widget class.
I came across this when trying to write template code to output form fields with custom markup and I was trying to use input_type to check what kind of field I’m looking at as I loop through them, only to find out that textareas don’t have that. Because it’s template code, options for determining what the field type is are pretty limited. I’m working around it by checking the widget’s template_name, but that feels a lot less clean.
I found a seven-year-old ticket for this issue that was closed as invalid with little discussion, and found it puzzling. I think @minusf 's final comment on the matter is pretty sound, but the discussion ended there:
I understand that the “abstraction” is leaking. But
SelectandRadioSelectboth haveinput_type, even if for a “different purpose”, those can be used in the same way asinput_typefor “true”Inputwidgets… It’s not ideal, but it’s already there and onlyTextareais left out in the cold. The other alternative could be to addwidget_typeor such to everyWidgetsubclass but at this point it would just duplicateinput_type.
I thought it might be impolite to just open a new issue, and a friend suggested it might be good to open a discussion here and try to get some community consensus, so here I am.
Would anyone else be interested in reconsidering this issue?