I want user to regist my app in two step
and this is how I did
def developRegistrationFirstStep(request):
if request.method == 'POST':
form = RegistrationForm(request.POST)
if form.is_valid():
new_user = User.objects.create_user(form.cleaned_data['username'], form.cleaned_data['email'], form.cleaned_data['password1'])
# user = authenticate(username=form.cleaned_data['email'], password=form.cleaned_data['password1'])
# if user is not None:
# if user.is_active:
# login(request, user)
return redirect('registration/secondstep')
else:
form = RegistrationForm()
return render_to_response('registration/registration_form.html',{'form':form},context_instance=RequestContext(request))
def developRegistrationSecondStep(request):
if request.method == 'POST':
form = ProfileInfo(request.POST)
if form.is_valid():
pass
note that both registration step has to be finished before the user can login
as u can see after user done with first step,I redirect the user to the second step,and here is the problem, in second step how can I get this half registed user? because I stroe the realinfo in UserProfile model,which gets created once the user instance gets created, I need to save the realinfo into this user's UserProfile, how can I do that?
这正是Django 表单向导是有用的工具
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.