Django Many To Many Insert Ordering

后端 未结 2 727
Happy的楠姐
Happy的楠姐 2020-12-10 14:14

We have been struggling with this for a few days and have done lots of searches on the web.

We are trying to figure out how entries are saved in Django forms for man

相关标签:
2条回答
  • 2020-12-10 14:45

    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.

    https://github.com/gregmuellegger/django-sortedm2m

    0 讨论(0)
  • 2020-12-10 14:52

    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.

    0 讨论(0)
提交回复
热议问题