In Django form, custom SelectField and SelectMultipleField

后端 未结 5 1606
野趣味
野趣味 2021-01-02 16:11

I am using Django everyday now for three month and it is really great. Fast web application development.

I have still one thing that I cannot do exactly how I want t

5条回答
  •  再見小時候
    2021-01-02 16:53

    http://code.djangoproject.com/browser/django/trunk/django/newforms/widgets.py?rev=7083

    As seen under the class Select(Widget):, there is no way to add the style attribute to an option tag. To this, you will have to subclass this widget and add such functionality.

    The class Select(Widget): definition only adds style attribute to the main select tag.

提交回复
热议问题