I have got following django code for Formwizard in python. First there are two forms:
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'
I am not getting why it is giving error mentioned in the Title. Moreover Google is also not providing any specific help. Could anyone of you please guess the cause of it. I suspect something wrong happening in Done method but not sure.
Thanks.
Think about what happens in process_step
if if's not step 0, or if it's a GET rather than a POST, or if the form is not valid. What is returned in those cases?