I want to pass value from one form to another but i am not using form wizard. my views:
def main_page(request):
#if request.method == 'POST':
#form = jobpostForm_first()
# if request.method == 'POST':
if request.method == 'POST':
#if '_Submit'in request.POST:
#if (form.data['post_type']=='Job'):
form = jobpostForm_first(request.POST)
if (form.data['post_type']=='Job'):
#if form.is_valid():
#form.save()
return render_to_response('portal/job_post.html',{'form':form},context_instance=RequestContext(request))
#else:
# return HttpResponseRedirect('/accounts/login/')
else:
form = jobpostForm_first()
c = {}
c.update(csrf(request))
return render_to_response('portal/job_post.html',{'form':form},context_instance=RequestContext(request))
def next(request):
#post_type= request.GET.get('post_type')
if request.POST['post_type']=='Job': # here it is giving me exception "Key 'post_type' not found in <QueryDict: {}>"
if request.method == 'POST':
form = jobpostForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect('/thanks/')
else:
form = jobpostForm()
else:
return HttpResponseRedirect('/accounts/login/')
c = {}
c.update(csrf(request))
return render_to_response('portal/job_post.html',{'form':form},context_instance=RequestContext(request))
I want pass the post_type to 2nd form.and on its basis i want to show other form. Can anyone tell me how can i do this?