Friday, October 20, 2017

Input Widget with multiple input_type attr

Hello,

I am having some problems with django 1.11 widgets, I was using django-widget-tweaks to help rendering form fields,
but now when I set a type="hidden" attribute to an Input Field, django creates the widget with both type="text" and type="hidden" attributes.
That happens because when the widget is initialized [1] it's input_type is set from the attrs.
But when the widget is rendered and the method get_context is called, it uses the old input_type attr, and not the new one that is sent[2] in attrs.

Is this some kind of bug or am I missing something?

Regards,

Gustavo

[1] https://github.com/django/django/blob/1.11.6/django/forms/widgets.py#L271
[2] https://github.com/django/django/blob/1.11.6/django/forms/widgets.py#L276

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cac48b38-6709-4307-b097-33c3c1076594%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment