我有一个函数friend_exists
这样的:函数需要2个参数时,应只有一个
def friend_exists(request, pid):
result = False
try:
user = Friend.objects.get(pid=pid)
except Friend.DoesNotExist:
pass
if user:
result = True
return result
我打电话它从我的其他功能像这样:
exists = friend_exists(form.cleaned_data['pid'])
其中pid = u'12345678'
。为什么我得到:
Exception Type: TypeError at /user/register/
Exception Value: friend_exists() takes exactly 2 arguments (1 given)
任何想法?
请修复帖子标题错字funciotn。 – sivabudh 2010-07-07 21:57:32