Hi Ross,
The empty Q is the same thing as nothing, no filter.
I need to filter the query according to the options the user checks on
the form.
So this line:
(form.data.get('my') and Q(friends_set=request.user.id) or Q())
means:
(if checkbox 'my' is checked filter using
(friends_set=request.us
Hi,
I've been following this thread to learn Django better. Could you
explain what the function of the empty Q is in your code, Enrico? What
does 'or Q()' do?
Cheers,
Ross
On Feb 7, 7:19 am, "Enrico" <[EMAIL PROTECTED]> wrote:
> Hi Russel,
>
> Thanks a lot, it worked now.
>
> I can't drop the
Hi Russel,
Thanks a lot, it worked now.
I can't drop the related_name clause, in the Profile model I have two
relationships to the User model: user (OneToOne) and friends (M2M).
Then Django complains that the reverse query names clashes on those
fields, forcing me to use a related_name.
If I us
On 2/6/07, Enrico <[EMAIL PROTECTED]> wrote:
>
> Hi Russel,
>
> I think that it doesn't solve the problem.
>
> I can use your solution to get my friends. But I need to include
> people who added me in the same listing.
>
> To get a list of people who added me I can use:
> people_who_added_me =
> a
Hi Russel,
I think that it doesn't solve the problem.
I can use your solution to get my friends. But I need to include
people who added me in the same listing.
To get a list of people who added me I can use:
people_who_added_me =
auth.models.User.objects.filter(profile__friends=my_id)
My probl
On 2/5/07, Enrico <[EMAIL PROTECTED]> wrote:
>
> I need to list the Users, with the possibility of using two filters:
> my friends and people who added me.
>
> I can list people who added me using:
> users = auth.models.User.filter(profile__friends=some_user_id)
>
> But I can't get the list of peo
Hi,
I have a Profile model with a OneToOne relationship to the auth.User
model.
In the Profile I have a ManyToMany relationship (non-symmetrical) to
the auth.User model called friends.
Something like this:
class Profile(models.Model):
user = models.OneToOneField(auth.models.User)
friends
7 matches
Mail list logo