发送邮箱验证时出现问题
来源:6-9 用户注册-3
Mrzzj
2017-11-08
代码打断点运行到user_profile.save()保存数据库的时候报错,显示ValueError: The view users.views.RegisterView didn't return an HttpResponse object. It returned None instead.
这是view
class RegisterView(View): def get(self, request): register_form = RegisterForm() return render(request, 'register.html', {'register_form': register_form}) def post(self, request): register_form = RegisterForm(request.POST) if register_form.is_valid(): user_name = request.POST.get('email', '') # 取request中POST的user_name和pass_word用于后面判断 pass_word = request.POST.get('password', '') user_profile = UserProfile() user_profile.username = user_name user_profile.email = user_name user_profile.is_active = False user_profile.password = make_password(pass_word) user_profile.save() send_register_email(user_name, 'register') return render(request, 'login.html')
写回答
1回答
-
往后看课程 后面马上会讲到的
032017-11-10
相似问题