Ordering of ManyToManyField using a field of the intermediate table

2 views
Skip to first unread message

Alex Rades

unread,
Jun 30, 2009, 4:34:19 AM6/30/09
to django-d...@googlegroups.com
Hi,
I've also asked on the users ml but got no anwser. Maybe you can
undestand the question better?

Hi,
I have a couple of models like:

class Album(models.Model):
title = models.CharField(max_length=255)

class Image(models.Model):
image = models.ImageField(upload_to='images/')
albums = models.ManyToManyField(Album, blank=True)

the schema of the intermediate table is, of course:

`id` int(11) NOT NULL auto_increment,
`image_id` int(11) NOT NULL,
`album_id` int(11) NOT NULL,

Is it possible to order album.image_set with respect to the ID field
of the intermediate table?
I'd like to do this so i can efficiently sort images in the order they
were added to the album.

Thank you!

Luke Plant

unread,
Jun 30, 2009, 5:12:28 AM6/30/09
to django-d...@googlegroups.com
On Tuesday 30 June 2009 09:34:19 Alex Rades wrote:
> Hi,
> I've also asked on the users ml but got no anwser. Maybe you can
> undestand the question better?

Please don't do that - the developers' list and the users' list have
distinct purposes, and the fact that you didn't get an answer on the
users' does not make this on-topic for developers'.

Thanks,

Luke

--
When you're great, people often mistake candor for bragging.
-- Calvin and Hobbes

Luke Plant || http://lukeplant.me.uk/

Reply all
Reply to author
Forward
0 new messages