debug的时候到is_valid()就出错了

来源:6-10 用户注册-4

慕设计4101219

2017-04-14

http://szimg.mukewang.com/58f0b1ca0001b6b814450401.jpg

http://szimg.mukewang.com/58f0b1ca0001c16e10320218.jpg

http://szimg.mukewang.com/58f0b1ca0001cb4d17040472.jpg

里面的valid=unknow

=====================================

就是F6到了register_form = RegisterForm(request.POST)

然后F6到了if register_form.is_valid():

在按F6不是到user_name = request.POST.get("email"," ")而是到了base.py里面的return handler(request,*args,**kwargs)

求指教

写回答

2回答

慕设计4101219

提问者

2017-04-17

因为后面没做下去,目前的代码是

class RegisterView(View):                

    。。。

    def post(self,request):

        register_form = RegisterForm(request.POST)

        if register_form.is_valid():

            user_name = request.POST.get("email"," ")

            。。。

            pass

按F8之后的错误是

ValueError at /register/

The view users.views.RegisterView didn't return an HttpResponse object. It returned None instead.

Request Method: POST

Request URL: http://127.0.0.1:8000/register/

Django Version: 1.9.8

Exception Type: ValueError

Exception Value:

The view users.views.RegisterView didn't return an HttpResponse object. It returned None instead.

Exception Location: D:\ruanjian\Anaconda2\lib\site-packages\django\core\handlers\base.py in get_response, line 158

Python Executable: D:\ruanjian\Anaconda2\python.exe

Python Version: 2.7.13

Python Path:

['D:\\ruanjian\\PycharmDjangos\\MxOnline\\extra_apps',
'D:\\ruanjian\\PycharmDjangos\\MxOnline\\apps',
'D:/ruanjian/PycharmDjangos/MxOnline',
'D:\\ruanjian\\pycharm\\PyCharm 2016.3.2\\helpers\\pydev',
'D:\\ruanjian\\PycharmDjangos\\MxOnline',
'D:\\ruanjian\\PycharmDjangos\\MxOnline\\extra_apps',
'D:\\ruanjian\\PycharmDjangos\\GaoJimuke',
'D:\\ruanjian\\PycharmDjangos\\MuDjango',
'D:\\ruanjian\\PycharmDjangos\\MxOnline\\apps',
'D:\\ruanjian\\Anaconda2\\Lib\\site-packages\\theano',
'D:\\ruanjian\\pycharm\\PyCharm 2016.3.2\\helpers\\pydev',
'D:\\ruanjian\\Anaconda2\\python27.zip',
'D:\\ruanjian\\Anaconda2\\DLLs',
'D:\\ruanjian\\Anaconda2\\lib',
'D:\\ruanjian\\Anaconda2\\lib\\plat-win',
'D:\\ruanjian\\Anaconda2\\lib\\lib-tk',
'D:\\ruanjian\\Anaconda2',
'D:\\ruanjian\\Anaconda2\\lib\\site-packages',
'D:\\ruanjian\\Anaconda2\\lib\\site-packages\\Sphinx-1.5.1-py2.7.egg',
'D:\\ruanjian\\Anaconda2\\lib\\site-packages\\win32',
'D:\\ruanjian\\Anaconda2\\lib\\site-packages\\win32\\lib',
'D:\\ruanjian\\Anaconda2\\lib\\site-packages\\Pythonwin',
'D:\\ruanjian\\Anaconda2\\lib\\site-packages\\setuptools-27.2.0-py2.7.egg',
'D:\\ruanjian\\Anaconda2\\lib\\site-packages\\IPython\\extensions']

Server time:

星期一, 17 四月 2017 09:47:39 +0800    

bobby老师,是不是不用管它继续做下去还是?


1
1
慕少4732649
我也遇到这个问题,验证码填错之后,RegisterForm并不报错 ,但register_form.is_valid不为真。显示unknow
2019-02-28
共1条回复

我就是人才

2017-04-14

说清楚

0
5
慕设计4101219
回复
bobby
已经知道原因了,不用麻烦老师了,输入地址错了
2017-04-17
共5条回复

Python3.6+django+xadmin,打造在线教育平台

【毕设】Python 2.7到3.6 完美适配,Django升级2.0

3677 学习 · 4038 问题

查看课程