On May 22, 4:34 pm, akaariai <akaar...@gmail.com> wrote: > So, you would want to do collection.songs.all() and have that ordered > by the sequence defined in the m2m table? I agree - this seems to be > somewhat hard currently.
I currently have a similar scheme in one of our projects, works fine as far as I can tell: class Categorie(Model): # .... class Blook(Model): # .... categories = models.ManyToManyField( Category, through='Classification', related_name="blooks", ) @property def sorted_categories(self): return self.categories.order_by("classifications__position") class Classification(Model): category = models.ForeignKey( Category, related_name="classifications" ) blook = models.ForeignKey( Blook, related_name="classifications" ) position = models.PositiveIntegerField( _(u"Position"), ) class Meta: unique_together = ( ("blook", "category"), ("blook", "position"), ) -- 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.