Skip to content

Conversation

EricHigdon
Copy link

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.

@EricHigdon EricHigdon changed the title Add Autoincrementing for reverse relationship modification Add Autoincrementing sort value for reverse relationship modification Jan 14, 2020
Copy link
Contributor

@clintonb clintonb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test/tests.

[pycodestyle]
max_line_length=120
exclude=migrations
ignore=W0613
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you need to disable this, use # pylint: disable=unused-argument at the appropriate location. Do not ignore warnings globally without a discussion. Also, this won't work because Pylint is configured in pylintrc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants