Hi

If you are only updating the class attribute you can do a direct assignment 
to the class attribute on the dictionary like:

self.fields['attendant_authority'].widget.attrs['class'] = 
'select_autoridad'
self.fields["prodotti_var"].widget.attrs["class"] = "form-control 
m-bootstrap-select m_selectpicker"


El miércoles, 8 de agosto de 2018, 6:47:31 (UTC-7), matteo gassend escribió:
>
> Hello everyone,
>
> I am trying to personalize my select fields in a django modelform, however 
> the changes are not reflected when I try to render the field. Anyone else 
> ever had this problem?
>
>         self.fields["prodotti_var"].widget.attrs.update({"class" : 
> "form-control 
> m-bootstrap-select m_selectpicker", "data-live-search" : "true"})
>
>
> Can you help me?
>
>
>
>
>
>
>

-- 
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+unsubscr...@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/9b61f397-677e-4368-8514-3ef7546bc913%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to