{"action":"created","issue":{"url":"https://api.github.com/repos/bfirsh/django-ordered-model/issues/85","repository_url":"https://api.github.com/repos/bfirsh/django-ordered-model","labels_url":"https://api.github.com/repos/bfirsh/django-ordered-model/issues/85/labels{/name}","comments_url":"https://api.github.com/repos/bfirsh/django-ordered-model/issues/85/comments","events_url":"https://api.github.com/repos/bfirsh/django-ordered-model/issues/85/events","html_url":"https://github.com/bfirsh/django-ordered-model/issues/85","id":145032352,"node_id":"MDU6SXNzdWUxNDUwMzIzNTI=","number":85,"title":"Switching \"with_respect_to\" model breaks ordering","user":{"login":"ckcollab","id":2185159,"node_id":"MDQ6VXNlcjIxODUxNTk=","avatar_url":"https://avatars2.githubusercontent.com/u/2185159?v=4","gravatar_id":"","url":"https://api.github.com/users/ckcollab","html_url":"https://github.com/ckcollab","followers_url":"https://api.github.com/users/ckcollab/followers","following_url":"https://api.github.com/users/ckcollab/following{/other_user}","gists_url":"https://api.github.com/users/ckcollab/gists{/gist_id}","starred_url":"https://api.github.com/users/ckcollab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ckcollab/subscriptions","organizations_url":"https://api.github.com/users/ckcollab/orgs","repos_url":"https://api.github.com/users/ckcollab/repos","events_url":"https://api.github.com/users/ckcollab/events{/privacy}","received_events_url":"https://api.github.com/users/ckcollab/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-03-31T22:10:09Z","updated_at":"2018-10-07T19:17:07Z","closed_at":null,"author_association":"NONE","body":"So with an initial ordering everything is great:\n\n![image](https://cloud.githubusercontent.com/assets/2185159/14192251/6340bf94-f751-11e5-81bc-e3385f4f294c.png)\n\nBut if I change parents of a category, like moving one category inside another (almost like DELETING that category) I get something like this, which is borked:\n\n![image](https://cloud.githubusercontent.com/assets/2185159/14192266/78092d44-f751-11e5-9b49-b160a7cbd5b6.png)\n(note missing #3)\n\nWhat's the proper way to solve this? I could just basically replicate `delete`?\n\n``` python\nqs = self.get_ordering_queryset()\nqs.filter(**{self.order_field_name + '__gt': getattr(self, self.order_field_name)})\\\n    .update(**{self.order_field_name: F(self.order_field_name) - 1})\n```\n\nAbove fixes the problem, wondering if maybe `OrderedTable` could detect this on save or something?? Or maybe a `switch_parents` kind of method?\n\nSide problem: When changing parents and then calling `bottom()` I seem to be getting weird order values as well.. still digging!\n\nEDIT:\nSetting `order = None` before calling `bottom()` seems to to have fixed some problems.\n"},"comment":{"url":"https://api.github.com/repos/bfirsh/django-ordered-model/issues/comments/427679013","html_url":"https://github.com/bfirsh/django-ordered-model/issues/85#issuecomment-427679013","issue_url":"https://api.github.com/repos/bfirsh/django-ordered-model/issues/85","id":427679013,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNzY3OTAxMw==","user":{"login":"shuckc","id":1188286,"node_id":"MDQ6VXNlcjExODgyODY=","avatar_url":"https://avatars0.githubusercontent.com/u/1188286?v=4","gravatar_id":"","url":"https://api.github.com/users/shuckc","html_url":"https://github.com/shuckc","followers_url":"https://api.github.com/users/shuckc/followers","following_url":"https://api.github.com/users/shuckc/following{/other_user}","gists_url":"https://api.github.com/users/shuckc/gists{/gist_id}","starred_url":"https://api.github.com/users/shuckc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shuckc/subscriptions","organizations_url":"https://api.github.com/users/shuckc/orgs","repos_url":"https://api.github.com/users/shuckc/repos","events_url":"https://api.github.com/users/shuckc/events{/privacy}","received_events_url":"https://api.github.com/users/shuckc/received_events","type":"User","site_admin":false},"created_at":"2018-10-07T19:17:07Z","updated_at":"2018-10-07T19:17:07Z","author_association":"COLLABORATOR","body":"It would be really great to get this into a PR and add some tests for this change. "}}
{"actor":{"display_login":"shuckc"}}