* has_patch: 0 => 1
* ui_ux: => 0
* easy: => 0
Comment:
I think changing the insertion order value calculation is the better
solution here; less expensive than reordering everything and simpler than
detection deletions *and* parent updates, etc. Patch and tests attached.
--
Ticket URL: <https://code.djangoproject.com/ticket/13296#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by julien):
Thanks for the patch, Simon! It looks pretty good to me. I'm just
wondering if the tests could be made a little more thorough by adding more
items, by doing more delete/add/move operations and by asserting the
actual values of each item's `_order` field. What do you think?
--
Ticket URL: <https://code.djangoproject.com/ticket/13296#comment:6>
Comment (by DrMeers):
I was steering away from making the tests '''too''' explicit, particularly
in regard to the value of the `_order` field -- I'd prefer to test the
behaviour rather than the implementation. Currently, for efficiency's
sake, if you delete an item you'll get a "gap" in the `_order` sequence. I
don't actually ''want'' the "gap" so much that I want to test for it, and
would like the tests to continue to pass even if someone later decides to
trigger reordering upon modification, or even if they wanted to switch
between zero/one-based indexing.
Another test or two based on delete/add/move operations wouldn't hurt,
though those I'd written were enough to convince me there were no logic
holes.
--
Ticket URL: <https://code.djangoproject.com/ticket/13296#comment:7>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/13296#comment:9>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/13296#comment:10>
* status: new => assigned
* owner: nobody => Hasan Ramezani
--
Ticket URL: <https://code.djangoproject.com/ticket/13296#comment:11>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"f97bbad908df128189eff77d98af9a25ed1ecf23" f97bbad]:
{{{
#!CommitTicketReference repository=""
revision="f97bbad908df128189eff77d98af9a25ed1ecf23"
Fixed #13296 -- Fixed ordering by Options.order_with_respect_to after
deleting objects.
Thanks Simon Meers for the original patch.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/13296#comment:12>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"2362f2726558dd0cc6e447878545dd3ddbd9b633" 2362f272]:
{{{
#!CommitTicketReference repository=""
revision="2362f2726558dd0cc6e447878545dd3ddbd9b633"
[3.0.x] Fixed #13296 -- Fixed ordering by Options.order_with_respect_to
after deleting objects.
Thanks Simon Meers for the original patch.
Backport of f97bbad908df128189eff77d98af9a25ed1ecf23 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/13296#comment:13>