I am trying to create a multi step form using model classes:
my view:
# this is my tz_create view
def makingx(request):
try:
#this is to check if user has filled info already before
dashprofile = DashboardProfile.objects.get(user=request.user)
#some view stuff
context = {
'user':user
}
return render_to_response(
'done.html',
context,
context_instance = RequestContext(request),
)
except DashboardProfile.DoesNotExist:
#some more stuff
if request.method == "POST":
if form.is_valid():
#more view stuff
request.session['created_busi'] = True
return HttpResponseRedirect(reverse('tx_create'))
else:
return render_to_response(
'd12.html',
{
'user':user},
context_instance = RequestContext(request)
)
my tx_create view:
def promocamp(request):
if 'created_info' not in request.session:
return HttpResponseRedirect(
reverse('tz_create')
)
user = request.user
if request.method == "POST":
if campaign.is_valid():
#some stuff
if 'next' in request.POST:
next = request.POST['next']
else:
next = reverse('busi_create')
return HttpResponseRedirect(next)
return render_to_response(
'd14.html',
{'CampaignForm':campaign,
'user':user},
context_instance = RequestContext(request)
)
Step needs to go from tz to tx create
However tx_create never seems to show up… what should i do / what could be the error?
From your code I see that
return HttpResponseRedirect(reverse('tx_create'))is called on three conditions:Just make sure that all three conditions are met. Use some debugging output in each of these conditions to see where the flow breaks.