Django - AttributeError - 'User' object has no attribute 'validate'
I'm g开发者_Python百科etting an AttributeError using rcrowley's django-twitterauth: http://github.com/rcrowley/django-twitterauth
Looks like it occurs when the validate() method is called on the user object, which the user object does not have. I don't know why the author did this. I'm really new to Django, wondering if anyone else knows. I know you can validate the model/data using the form object, but it looks like there's no form here:
@needs_user('auth_login')
def info(req):
if 'POST' == req.method:
req.user.email = req.POST['email']
errors = req.user.validate()
if not errors: req.user.save()
return render_to_response('info.html', {
'user': req.user,
'errors': errors
})
return render_to_response('info.html', {'user': req.user})
The default django contrib.auth.models.User
may not have a validate()
command, but the twitterauth.models.User
does have one ... did you make any changes to ensure your project is using the twitterauth's model and not the default one ?
精彩评论