python - It doesnt work to specify CSS class for ModelChoiceField -


I have read through some widget documents and after seeing some thread on the stack overflow, I found some people There is only one problem, but their solution does not work for me.

I am trying to specify the CSS class for ModelChoiceField and the error of getting "error" only " init ) at least 2 non-keyword arguments (1 Given ").

This is the code related to me:

  import from django.forms ModelForm, ModelChoiceField .. widgets = {'rangeID': ModelChoiceField ( Queryset = "", widget = ModelChoiceField (attrs = {'class': 'form-control'})}} ..  

I read in two other answers that they characterize attrs As a feature of the field Were trying to Irdisht and widgets, so when specified as up to a feature widget, but it still does not work.

Any thoughts?

Anyway, you are trying to pass the whole area in widgets as you like As the name suggests, you have to pass the widget itself. In addition, you have set both field and widgets as field classes. Obviously, the widget should actually have a widget, no fields.

  widgets = {'categoryID': forms.SelectMultiple (attrs = {'class': 'form-control'})}  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -