- changed status to wontfix
Modifying ordered relation does not honour ordering
Issue #1261
resolved
I am not quite sure if this should be considered a bug in SQLAlchemy, or missing documentation.
I have an ordered relation between a Page object and many Comment objects. If I add a new Comment object to the relation it is always appended at the end instead of in being inserted at the right ordered position. To get the ordering correct I have to explicitly expire the Page instance first.
I have added a simple test which demonstrates this behaviour: the ordering is different before and after the expire:
$ python ordering.py
Comment ordering: Tomorrow Yesterday
Expiring
Comment ordering: Yesterday Tomorrow
Comments (1)
-
repo owner - Log in to comment
this is expected behavior. look into the "orderinglist" extension for in-python sorting of values. /docs/05/reference/ext/orderinglist.html