I have a general question regarding the ordering in the ManyRelatedManager object. For example, There are two classes in my model: one is called Book for books and another is Author for authors.
A many-to-many field is defined in class Book authors = models.ManyToManyField(Author)
In database, the many-to-many relationship is described in an additional table book_author with three columns: (id, book_id, author_id)
Now for a Book object b, both b.authors.all() and b.authors.iterator() are sorted in the order of book_author.author_id. But what I want is to retrieve the authors of b in the order of book_author.id because this is the right order of the authors.
Any solutions? Many thanks in advance!