Modifying ordered relation does not honour ordering

Issue #1261 resolved
Former user created an issue

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)

  1. Log in to comment