1.引入
<link rel="stylesheet" href="{% static "plugin/bootstrap-select/css/bootstrap-select.css" %}">
<script src="{% static "plugin/bootstrap-select/js/bootstrap-select.min.js" %}"></script> <script src="{% static "plugin/bootstrap-select/js/i18n/defaults-zh_CN.min.js" %}"></script>
2.初始化
class issuesForm(BootStrapForm,forms.ModelForm): class Meta: model = models.Issues exclude = ["project","create_time","lastest_update_time","creator"] widgets = { "assign":forms.Select(attrs={ "class":"selectpicker","data-live-search":"true" }), "watcher":forms.widgets.SelectMultiple( attrs={"class":"selectpicker","data-live-search":"true","data-actions-box":"true"} ), "start_time":forms.DateTimeInput(attrs={"autocomplete":"off"}), "end_time":forms.DateTimeInput(attrs={"autocomplete":"off"}) }