Monday, September 26, 2011

Using exists() on queryset for a User

I'm trying to check if a user with a specified email already exists.
According to the docs, it's better to use the .exists() method.

I tried this:

if User.objects.exists(email = data['email']):
raise forms.ValidationError(u'Email Already Exists')

However, I get this error:

exists() got an unexpected keyword argument 'email'

I'm just going to assume I went about this the wrong way. Any
suggestions on how to do it the right way?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate