Re: Query friends of an user

2013-12-17 Thread Arthur Silva
ser has. If you just want the list of friends then > extend that query with a values_list like so: > > Friendship.objects.filter(user__pk = 32, status__in = [Friendship.FRIEND, > Friendship.FAVORITE]) .values_list('friend', flat=True) > > > > On Tuesday, December 17, 20

Query friends of an user

2013-12-17 Thread Arthur Silva
I want to query the friends of an User but I'm struggling to get the correct query. Models: class User(AbstractUser, TimestampedModel, SerializeMixin): city = models.CharField(max_length=60, blank=True) picture = models.URLField(blank=True) cover_picture =

Re: Django ORM generating the wrong query for recent friends of an user

2013-10-16 Thread Arthur Silva
4, 2013 10:50:54 AM UTC-3, Arthur Silva wrote: > > Here're my models > > > class PingUser(AbstractUser): > friends = models.ManyToManyField("self", through="Friendship", > symmetrical=False) > > class Friendship(Ti

Django ORM generating the wrong query for recent friends of an user

2013-09-24 Thread Arthur Silva
Here're my models class PingUser(AbstractUser): friends = models.ManyToManyField("self", through="Friendship", symmetrical=False) class Friendship(TimestampedModel, SerializeMixin): STATUS_CHOICES = ( ("pending", "Pending"), ("friend",