Monday, July 31, 2017

How can I add attrs in ModelChoiceField?

Hello,Everyone,
I know charField can use
forms.TextInput(attrs={'class' : 'form-control',
}),
or
forms.Textarea(attrs={'class' : "form-control",
'rows' : 3 ,
})

to set widgets

but ModelChoiceField?
I have no idea,Django telled me "'module' object has no attribute 'ChoiceInput'"
when i use
forms.ChoiceInput
and "__init__() got an unexpected keyword argument 'attrs'" when i use ModelChoiceField


Can you help me?
Thank you very much?

--
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/2f1dcb5f-cf3c-4dca-8403-1dcdfcef0bf4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment