Re: Using .values() on a query?

2007-03-10 Thread [EMAIL PROTECTED]
Malcom... thanks for all the info :) I didn't paste all of my model code into the sample... each of those tables actually has Foreign Keys to a few other things..which also contains foreign keys... The page that was slowing down was a page where I basically had a drop down showing Companies (

Re: Using .values() on a query?

2007-03-09 Thread Malcolm Tredinnick
On Sat, 2007-03-10 at 03:03 +, [EMAIL PROTECTED] wrote: > Is there a way to load a related object by still using .values()? [... example snipped ...] > And for company I only want to > load .values('company_name','company_id') , but for each company in > the result set...I want to be able to

Re: Using .values() on a query?

2007-03-09 Thread [EMAIL PROTECTED]
Ok...if there is a better way to do this...please let me know..but since I couldn't figure out how to get the office_set populated...I just did this: all_companies = Company.objects.all().order_by('company_name').distinct()#.values('company_id','company_name') #offices for the com

Re: Using .values() on a query?

2007-03-09 Thread [EMAIL PROTECTED]
Is there a way to load a related object by still using .values()? For example I have: class Company(models.Model): company_id = models.AutoField(primary_key=True) parent_company = models.ForeignKey("self",null=True) address = models.ForeignKey('Address',related_name="company_address"

Re: Using .values() on a query?

2007-03-09 Thread [EMAIL PROTECTED]
Coffee hasn't kicked in yet...I figured it out about 5 minutes after asking... and was about to post back the same thing! Thanks! On Mar 9, 9:47 am, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Fri, 2007-03-09 at 14:39 +, [EMAIL PROTECTED] wrote: > > Pehraps I'm doing something wrong h

Re: Using .values() on a query?

2007-03-09 Thread Malcolm Tredinnick
On Fri, 2007-03-09 at 14:39 +, [EMAIL PROTECTED] wrote: > Pehraps I'm doing something wrong here. I should mention I am using > the multiple-database branch, so perhaps it's a bug...but thought I'd > check if my syntax is correct. > > I'm trying to trim down the data returned from a query to

Using .values() on a query?

2007-03-09 Thread [EMAIL PROTECTED]
Pehraps I'm doing something wrong here. I should mention I am using the multiple-database branch, so perhaps it's a bug...but thought I'd check if my syntax is correct. I'm trying to trim down the data returned from a query to speed things up, as I only need three fields for this particular piec