Re: using chaining filter() and select_related()

2007-08-07 Thread james_027

hi

On Aug 8, 1:45 pm, Margaret <[EMAIL PROTECTED]> wrote:
> how
>
> employees = employees.join(employees.filter(Q(firstname = p) | Q(lastname= 
> p)))
>

is this something new that hasn't been yet documented?

james


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



Re: using chaining filter() and select_related()

2007-08-07 Thread Margaret

how


employees = employees.join(employees.filter(Q(firstname = p) | Q(lastname= p)))



On 8/8/07, james_027 <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> On Aug 8, 1:37 pm, Udi <[EMAIL PROTECTED]> wrote:
> > Try doing the select_related() at the end
> >
> > Remove the first use of it and then after the loop add this:
> > employees = employees.select_related()
> >
> > I think that'll work?
> >
>
> I try but it didn't work ...
>
> james
>
>
> >
>


-- 
[EMAIL PROTECTED]
13585201588

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



Re: using chaining filter() and select_related()

2007-08-07 Thread james_027

Hi,

On Aug 8, 1:37 pm, Udi <[EMAIL PROTECTED]> wrote:
> Try doing the select_related() at the end
>
> Remove the first use of it and then after the loop add this:
> employees = employees.select_related()
>
> I think that'll work?
>

I try but it didn't work ...

james


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



Re: using chaining filter() and select_related()

2007-08-07 Thread Udi

Try doing the select_related() at the end

Remove the first use of it and then after the loop add this:
employees = employees.select_related()

I think that'll work?


On Aug 7, 10:25 pm, james_027 <[EMAIL PROTECTED]> wrote:
> hi,
>
> I am doing something like this
>
> params = request.GET['name'].split()
> employees = Employee.objects.all().select_related()
>
> for p in params:
> employees = employees.filter(Q(firstname = p) | Q(lastname
> = p))
>
> the query is fine but when I look at the connection.queries django
> still is not using join selects ...
>
> Any idea?
>
> james


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



using chaining filter() and select_related()

2007-08-07 Thread james_027

hi,

I am doing something like this

params = request.GET['name'].split()
employees = Employee.objects.all().select_related()

for p in params:
employees = employees.filter(Q(firstname = p) | Q(lastname
= p))

the query is fine but when I look at the connection.queries django
still is not using join selects ...

Any idea?

james


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