Re: Query friends of an user

2013-12-17 Thread Arthur Silva
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, 2013 8:50:09 AM UTC-6,

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 = models.URLField(blank=True

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

2013-10-16 Thread Arthur Silva
ay, September 24, 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) > >

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", "Friend