Re: order by count of related object

2009-06-30 Thread graeme
This appears to be a new feature. Is there any way of doing this in 1.0? Other than dropping into SQL that is. Graeme On Jun 17, 8:04 pm, Alex Gaynor wrote: > On Wed, Jun 17, 2009 at 10:00 AM, R C wrote: > > > Thanks for your fast reply > > > I realize that there is no "count" field in m

Re: order by count of related object

2009-06-17 Thread R C
Thanks, it worked! Both of you have been very helpful. On Jun 17, 5:04 pm, Alex Gaynor wrote: > On Wed, Jun 17, 2009 at 10:00 AM, R C wrote: > > > Thanks for your fast reply > > > I realize that there is no "count" field in my article model.  However > > in my templates I am able to do thi

Re: order by count of related object

2009-06-17 Thread Alex Gaynor
On Wed, Jun 17, 2009 at 10:00 AM, R C wrote: > > Thanks for your fast reply > > I realize that there is no "count" field in my article model. However > in my templates I am able to do things like: > Author.article_set.count > > I just can't do the same thing in my views when building a > que

Re: order by count of related object

2009-06-17 Thread R C
Thanks for your fast reply I realize that there is no "count" field in my article model. However in my templates I am able to do things like: Author.article_set.count I just can't do the same thing in my views when building a queryset.I would really like to be able to select Authors and

Re: order by count of related object

2009-06-17 Thread Daniel Roseman
On Jun 17, 1:12 pm, R C wrote: > Hi, > > I would like to be able to select objects and order them by the count > of a related field > > For example, I have 2 models: > > class Author(models.Model) >     name = models.Charfield(max_length=20) > > class Article(models.Model) >     author = models.F

order by count of related object

2009-06-17 Thread R C
Hi, I would like to be able to select objects and order them by the count of a related field For example, I have 2 models: class Author(models.Model) name = models.Charfield(max_length=20) class Article(models.Model) author = models.ForeignKey(Author) content = models.TextField()