On Sat, Nov 14, 2009 at 11:21 AM, Carlos Ricardo Santos <
[email protected]> wrote:

> Hi,
>
> I extended the user class with a UserProfile, with the Django docs
> tutorial.
> But now I need to do a query to list all users that haven't payed
> (pay='No').
>
>
> I tried something like this: *User.objects.filter(
> User.get_profile().paid='No' )*
> or *User.objects.filter( User.profile.paid='No' )*
>
>
The user profile is just a model with a ForeignKey to User, so you can use
standard ORM methods for accessing it from the User model, you do not have
to go through get_profile().  So try:

User.objects.filter(userprofile__paid='No')

Karen

--

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


Reply via email to