Tuesday, October 24, 2017

Re: Input Widget with multiple input_type attr

forms.TextInput(attrs={'type': 'hidden'})

On Tue, Oct 24, 2017 at 7:08 PM, gugsrs <rsiqueira.gustavo@gmail.com> wrote:
But isn't there any other way to change that attribute from my template for example?

Thank you for the reply.

On Saturday, October 21, 2017 at 4:19:21 AM UTC-2, k2527806 wrote:
forms.CharField(widget=forms.HiddenField)

On Oct 21, 2017 12:45 AM, "gugsrs" <rsiqueir...@gmail.com> wrote:
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

--
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...@googlegroups.com.
To post to this group, send email to django...@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.

--
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/43a48b04-a2b1-46d6-a16e-6ce82a4393d0%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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/CACOk0Twd1vT-WgL9Q7PZoqUdbXm-kC7VM4-bHgD7J494vMXTFg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment