Django'str'对象在表单提交时不可调用

时间:2013-03-12 23:31:58

标签: django django-views django-urls

尝试为表单提交执行ajax请求,但不断收到上述错误。

我的urls.py

urlpatterns += patterns('',
    url(r'^register-me/$', 'registerMe', name='registerMe'),
)

我的views.py

def registerMe(request):
inviteeEmail = 'ryan@nenvy.com'
inviteeName = 'ryan'

异常数据

    Traceback:
File "/Users/psdstaff/Projects/project/venv/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  111.                         response = callback(request, *callback_args, **callback_kwargs)

Exception Type: TypeError at /register-me/
Exception Value: 'str' object is not callable
Request information:
GET:
name = u'asdf'
email = u'asdf'

1 个答案:

答案 0 :(得分:3)

在您的网址中,您需要指定查看功能的完整路径:

urlpatterns += patterns('',
    url(r'^register-me/$', 'app.views.registerMe', name='registerMe'),
)