On Thu, Jul 7, 2011 at 3:49 PM, DrBloodmoney wrote:
> On Thu, Jul 7, 2011 at 12:04 AM, Venkatraman S wrote:
> > I am doing some bechmarking on the performance of both the versions of
> the
> > query:
> > 1.
> >
> Item.objects.filter(created_by__employees__org__in=u.employees_set.all().values_lis
On Thu, Jul 7, 2011 at 12:04 AM, Venkatraman S wrote:
> I am doing some bechmarking on the performance of both the versions of the
> query:
> 1.
> Item.objects.filter(created_by__employees__org__in=u.employees_set.all().values_list('org'))
> and
> 2. Items.objects.extra(where=['created_by_id in (s
I am doing some bechmarking on the performance of both the versions of the
query:
1.
Item.objects.filter(created_by__employees__org__in=u.employees_set.all().values_list('org'))
and
2. Items.objects.extra(where=['created_by_id in (select e.user_id from
myapp_employees e, myapp_organization o where
On Wed, Jul 6, 2011 at 8:09 PM, Marc Aymerich wrote:
> I swear this time it will work!
>
> Item.objects.filter(created_by__employees__org__in=u.employees_set.all().values_list('org'))
>
>
I cried on seeing this ;) Thanks a tonne. Guess this will go into the
django hall of fame!
But i have a Q :
On Wed, Jul 6, 2011 at 2:46 PM, Venkatraman S wrote:
>
>
> On Wed, Jul 6, 2011 at 2:10 PM, Marc Aymerich wrote:
>>
>> This one should work:
>> Items.objects.filters(created_by__employee__org=A.org)
>
> Nope. Emp has a FK for User, not the other way round.
I swear this time it will work!
Item.obj
On Wed, Jul 6, 2011 at 2:40 PM, akaariai wrote:
> Maybe this?
>
> user = current_user
> user_org_employees = Employees.objects.filter(org=user.org)
> user_org_items =
> Items.objects.filter(created_by__in=user_org_employees)
>
No, users can belong to multiple organizations, so no using user.org.
On Jul 5, 10:06 pm, Venkatraman S wrote:
> I tried asking around in IRC, and stumbled on a few possible solutions,
> would be great if someone shed some more light:
>
> I have the following models:
>
> class Organization(models.Model):
> name = models.CharField(max_length=100, bla
On Wed, Jul 6, 2011 at 2:10 PM, Marc Aymerich wrote:
> This one should work:
> Items.objects.filters(created_by__employee__org=A.org)
>
Nope. Emp has a FK for User, not the other way round.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To p
On Wed, Jul 6, 2011 at 4:46 AM, Venkatraman S wrote:
>
> On Wed, Jul 6, 2011 at 2:26 AM, Marc Aymerich wrote:
>
>> Say there are 3 Users in an org : A, B and C with each creating 3,4,5
>> items respectively, and 'A' is the current user; then i need a query which
>> returns all these items(i.e, 1
On Wed, Jul 6, 2011 at 8:39 AM, Venkatraman S wrote:
>
> On Wed, Jul 6, 2011 at 12:36 AM, Venkatraman S wrote:
>
>> I tried asking around in IRC, and stumbled on a few possible solutions,
>> would be great if someone shed some more light:
>>
>> I have the following models:
>>
>> class Organizati
On Wed, Jul 6, 2011 at 12:36 AM, Venkatraman S wrote:
> I tried asking around in IRC, and stumbled on a few possible solutions,
> would be great if someone shed some more light:
>
> I have the following models:
>
> class Organization(models.Model):
> name= models.CharField(max_l
On Wed, Jul 6, 2011 at 2:26 AM, Marc Aymerich wrote:
> Say there are 3 Users in an org : A, B and C with each creating 3,4,5 items
> respectively, and 'A' is the current user; then i need a query which returns
> all these items(i.e, 12 items) when i supply A..
>
> Item.objects.filter(employees__o
On Tue, Jul 5, 2011 at 9:06 PM, Venkatraman S wrote:
> I tried asking around in IRC, and stumbled on a few possible solutions,
> would be great if someone shed some more light:
>
> I have the following models:
>
> class Organization(models.Model):
> name= models.CharField(max_le
I tried asking around in IRC, and stumbled on a few possible solutions,
would be great if someone shed some more light:
I have the following models:
class Organization(models.Model):
name= models.CharField(max_length=100, blank=False)
class Employees(models.Model):
org
14 matches
Mail list logo