Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python ';非类型';对象没有属性';设置cookie';_Python_Django_Formwizard - Fatal编程技术网

Python ';非类型';对象没有属性';设置cookie';

Python ';非类型';对象没有属性';设置cookie';,python,django,formwizard,Python,Django,Formwizard,我在python中获得了Formwizard的以下django代码。首先有两种形式: class AuthenticationForm(forms.Form): FirstName = forms.CharField(max_length=500) LastName = forms.CharField(max_length=500) class SurveyForm(forms.Form): def __init__(self, *args, **kwa

我在python中获得了Formwizard的以下django代码。首先有两种形式:

 class AuthenticationForm(forms.Form):
      FirstName = forms.CharField(max_length=500)
      LastName = forms.CharField(max_length=500)

 class SurveyForm(forms.Form):
      def __init__(self, *args, **kwargs):
       super(SurveyForm, self).__init__(*args, **kwargs)
       for question in choiceValue:
                self.fields[question] =  forms.ChoiceField(choices=CHOICES,widget=RadioSelect())

class ContactWizard(FormWizard):
choiceValue = []

def get_template(self,step): 
    if step == 0:
        return 'wizard0.html'
    if step == 1:
        return 'wizard1.html'

def process_step(self, request, form, step):
    if (step == 0):      
        fullName=""      
        if request.method== 'POST':               
            if form.is_valid():  
                FirstName = form.cleaned_data['FirstName']
                LastName = form.cleaned_data['LastName']
                FirstNameU=FirstName.capitalize()
                LastNameU=LastName.capitalize()
                fullName=FirstNameU+" "+LastNameU
                personURIfn=GraphR.triples((None,FOAF_NS['givenName'],Literal(FirstNameU)))
                personURIln=GraphR.triples((None,FOAF_NS['familyName'],Literal(LastNameU)))          
                for purifn in personURIfn:
                    purifnStr='%s' %purifn[0]
                    for puriln in personURIln:     
                        purilnStr='%s' %puriln[0]
                        if purifnStr == purilnStr:               
                            personURI=purifnStr
                            friendKnows=GraphR.triples((URIRef(purifnStr),FOAF_NS['knows'],None))
                            for fk in friendKnows: #and scn1 not in epuriList1:            
                                fkStr='%s' %fk[2]
                                choiceValue.append(fkStr)
                return render_to_response('wizard1.html', RequestContext(request))


def done(self, request, form_list):
    print 'run'
我不明白为什么它会给出标题中提到的错误。此外,谷歌也没有提供任何具体帮助。你们谁能猜出原因吗。我怀疑Done方法中发生了错误,但不确定


谢谢。

如果不是步骤0,或者如果是GET而不是POST,或者如果表单无效,请思考
过程步骤中会发生什么。在这些情况下返回的是什么?

想想如果不是步骤0,或者是GET而不是POST,或者表单无效,在
过程步骤中会发生什么。在这些情况下返回什么?

我添加了步骤1,elif(步骤==1):if request.method='POST':print'Step1 is',step,但在完成后,我必须从choicefields向数据库中添加数据。我怎样才能继续?请引导。顺便说一下,它仍然给出相同的错误。”非类型“对象没有属性”set_cookie“我添加了步骤1,elif(步骤==1):if request.method='POST':print'Step1 is',step,但在完成后,我必须从choicefields向数据库中添加数据。我怎样才能继续?请引导。顺便说一下,它仍然给出相同的错误。”“非类型”对象没有属性“set\u cookie”