Django doesn’t guarantee to preserve the order of many-to-many relationships. If you need this, you should use a
through table with an explicit ‘order’ field.
Thankfully, order can now be preserved in a ManyToMany relationship without the extra complexity of using a through model using sortedm2m which is a drop-in replacement for django’s own ManyToManyField.
- How to restrict Django Rest Framework browsable API interface to admin users
- Django m2m form save " through " table
- How do you update a Django Form Meta class fields dynamically from the form constructor?
- What's the best way to create a model object in Django?
- Add context to every Django Admin page