Re: Can I control contents of SELECT in queryset?

2009-02-02 Thread Malcolm Tredinnick
On Mon, 2009-02-02 at 09:50 -0800, phoebebright wrote: > After replicating you test and it still failing and various other > experiments I downloaded the latest django trunk and it works fine! > Always check the version first Phoebe! > > Sorry for the run around. > > For the record here are the

Re: Can I control contents of SELECT in queryset?

2009-02-02 Thread phoebebright
After replicating you test and it still failing and various other experiments I downloaded the latest django trunk and it works fine! Always check the version first Phoebe! Sorry for the run around. For the record here are the two queries - correct one first, the difference is in the SELECT

Re: Can I control contents of SELECT in queryset?

2009-01-30 Thread Malcolm Tredinnick
On Fri, 2009-01-30 at 07:46 -0800, phoebebright wrote: > Using your suggestion returns no values: Then there is something else going on in your code that is important and you haven't mentioned yet. If I use exactly the models you give: > class Category(models.Model): > name =

Re: Can I control contents of SELECT in queryset?

2009-01-30 Thread phoebebright
Using your suggestion returns no values: In [9]: Subcategory.objects.values('name').exclude(business=None) Out[9]: [] And there are subcategories: In [10]: Subcategory.objects.values('name') Out[10]: [{'name': u'Agricultural'}, {'name': u'Auctioneers & Estate Agents'}, {'name': u'Construction

Re: Can I control contents of SELECT in queryset?

2009-01-29 Thread Malcolm Tredinnick
On Thu, 2009-01-29 at 06:44 -0800, phoebebright wrote: > I want a distinct list of all the 'cat__names' that exist in > Subcategory and have at least one entry in Business (Business is a > subclass of model Directory which might be the problem) > > dir_query =

Re: Can I control contents of SELECT in queryset?

2009-01-29 Thread phoebebright
That's an interesting post but I havn't managed to get it to solve my problem because I'm looking for a list of all categories and that method using FOO_set only seems to work on a single object (get). Also tried the raw sql method but I get an SQL error (1064, "You have an error in your SQL

Re: Can I control contents of SELECT in queryset?

2009-01-29 Thread Almost George
On Jan 29, 8:44 am, phoebebright wrote: > I want a distinct list of all the 'cat__names' that exist in > Subcategory and have at least one entry in Business (Business is a > subclass of model Directory which might be the problem) > > dir_query =

Can I control contents of SELECT in queryset?

2009-01-29 Thread phoebebright
I want a distinct list of all the 'cat__names' that exist in Subcategory and have at least one entry in Business (Business is a subclass of model Directory which might be the problem) dir_query = Business.objects.all().select_related().distinct() ... subcats =