Thanks for the help, Karen, Solved :D
Django is really so simple... I just keep thinking it has limits... The
limit is only the mind.
--------------------------

Karen's way:

*User.objects.filter( profile__paid='N' )* #works great!

Or even another way I found now:

*profiles= UserProfile.objects.filter(paid='N')*

and in template, to access the User object just call:

(...)

{% *for profile in profiles*%}
       <p>User {% *profile.user.username* %} haven't payed yet</p>

(...)

By this way I just rendered the profile and accessed the super class

Thanks Karen.


2009/11/14 Karen Tracey <kmtra...@gmail.com>

> On Sat, Nov 14, 2009 at 11:21 AM, Carlos Ricardo Santos <
> carlosricardosan...@gmail.com> 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 django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=.
>



-- 
Cumprimentos,
Carlos Ricardo Santos

--

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


Reply via email to