我希望用户分两步注册我的应用
这就是我的做法
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
请注意,必须在用户登录之前完成注册步骤
用户完成第一步后,我可以看到,我将用户重定向到第二步,这是问题所在,第二步,如何才能获得这个半登记用户?因为我在UserProfile模型中使用了realinfo,它在创建用户实例后创建, 我需要将realinfo保存到此用户的UserProfile中,我该怎么做?