hi guys,
let's say i have a ManyToMany relationship with an intermediary model;
something like this:

class Person(models.Model):
    name = models.CharField(max_length=128)
class Group(models.Model):
    name = models.CharField(max_length=128)
    members = models.ManyToManyField(Person, through='Membership')
class Membership(models.Model):
    person = models.ForeignKey(Person)
    group = models.ForeignKey(Group)
    order = models.IntegerField()


how do i set it up so that when i query Persons belonging to Groups, it
returns results in order?
so that, if I have

g = Group.objects.get(pk=1)

then, the line
g.members.all()

should return the members sorted by order.  I tried adding
class Meta:
     ordering = ('order',)
into the Membership class, but it's not working.


the reason i need this is that i have an admin interface for Groups, but the
members are getting found in the wrong order, which messes things up in the
field.

thanks in advance for your help!

-andy

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to