我正在使用Django 1.6和django-autocomplete-light 2.0.0a15,我正在尝试删除表单中的Hold down "Control", or "Command" on a Mac, to select more than one.
字符串。
根据文档(https://django-autocomplete-light.readthedocs.org/en/v2/faq.html#how-to-work-around-django-bug-9321-hold-down-control),我应该在表单定义中使用SelectMultipleHelpTextRemovalMixin
。
我尝试了以下内容:
import autocomplete_light
autocomplete_light.autodiscover()
from django import forms
from .models import SomeModel
class CreatePatFromEidForm(autocomplete_light.SelectMultipleHelpTextRemovalMixin, autocomplete_light.ModelForm):
class Meta:
model = SomeModel
......但这会产生:
TypeError: Error when calling the metaclass bases
Cannot create a consistent method resolution
order (MRO) for bases ModelForm, SelectMultipleHelpTextRemovalMixin
知道这是由于什么原因吗?
答案 0 :(得分:1)
您发布的文档链接说:
只需使用autocomplete_light.ModelForm 或继承SelectMultipleHelpTextRemovalMixin和django.forms.ModelForm。
如果使用autocomplete_light.ModelForm
,则无需手动使用SelectMultipleHelpTextRemovalMixin
;)