NameError:name' ModelSelect2MultipleField'没有定义

时间:2016-09-26 15:41:59

标签: python django

当我运行一个说明ModelSelect2MultipleField未定义的程序时,我收到错误。我在这里用它:

from django import forms
from django_select2 import *
from django.db.models import Q
from contacts.models import Contact
from cards.models import JobCard
from employee.models import *

from django.core.exceptions import ValidationError

def validate_fail_always(value):
    raise ValidationError(u'%s not valid. Infact nothing is valid!' % value)

########### Forms ##############]

class GetContactSearchForm(forms.Form):
    clients = ModelSelect2MultipleField(queryset=Contact.objects, required=False)

class GetEmployeeSearchForm(forms.Form):
    employees = ModelSelect2MultipleField(queryset=Employee.objects, required=False)

我的python版本为2.7.10,我的django1.8;我应该用我的settings.py文件替换那个字段,或者我需要安装或放入其他东西吗? 谢谢!

0 个答案:

没有答案