Re: Many to many relationship with intermediate class and sorting

2006-08-11 Thread Nick Lane
On Fri, 2006-08-11 at 21:56 +1000, Malcolm Tredinnick wrote: > In fact, despite you giving me all this extra information (thanks!), now > that I'm concentrating, it's actually a little bit clearer what the > problem is. The order_by(...) clause is a little inconsistent with the > other query co

Re: Many to many relationship with intermediate class and sorting

2006-08-11 Thread Malcolm Tredinnick
Hi Nick, On Fri, 2006-08-11 at 20:33 +0930, Nick Lane wrote: [...] > Okay, basically I want the photos with the highest rating for the album. > I've messed around with a few ways of doing it, but at the moment I have > something like: > > models.py: > > class AlbumPhotoManager(models.Manager):

Re: Many to many relationship with intermediate class and sorting

2006-08-11 Thread Nick Lane
> > class Photo(models.Model): > > title = models.CharField(maxlength=50) > > rating = models.PositiveIntegerField(default=0) > > > > class Album(models.Model): > > title = models.CharField(maxlength=50) > > pub_date = models.DateField() > > > > class AlbumPhoto(models.Model): >

Re: Many to many relationship with intermediate class and sorting

2006-08-10 Thread Malcolm Tredinnick
On Thu, 2006-08-10 at 22:09 +0930, Nick Lane wrote: > Hi everyone, > > I'm a relatively new user to Python and Django, and I'm impressed so far > - very nice! > > I have a question regarding the app I'm currently developing - a photo > album. Here is a rough copy of my models.py (trimmed for bre

Many to many relationship with intermediate class and sorting

2006-08-10 Thread Nick Lane
Hi everyone, I'm a relatively new user to Python and Django, and I'm impressed so far - very nice! I have a question regarding the app I'm currently developing - a photo album. Here is a rough copy of my models.py (trimmed for brevity): class Photo(models.Model): title = models.CharField(m