django-sortedm2m
django-sortedm2m copied to clipboard
Add Autoincrementing sort value for reverse relationship modification
When modifying a sortedm2m relationship from the "to" model admin, the default sort value of 0 is used, which means new instance is added to the top of the sorted list. Ideally, new records would be sorted last be default.
Adding an m2m_changed listener for the intermediate model allows us to make sure that new records have a sort value higher than the last item already in the list.