4 Jul 08:17
ordering list: list order not updated on delete (orm)
From: wobsta <wobsta <at> gmail.com>
Subject: ordering list: list order not updated on delete (orm)
Newsgroups: gmane.comp.python.sqlalchemy.user
Date: 2009-07-04 06:21:44 GMT
Subject: ordering list: list order not updated on delete (orm)
Newsgroups: gmane.comp.python.sqlalchemy.user
Date: 2009-07-04 06:21:44 GMT
Hi, in my following example I don't know how to properly delete items in an ordered list. I can't call items.remove (as I would violate the "items must be in a list rule"). If I delete the item, the list order get's not updated. Is there a way to automate the necessary reorder call for this case? Additinally, what is the proposed way to reorder an ordered list such that the positions are updated automatically? Best, André PS: I'm running SQLAlchemy 0.5.4p2 on Python 2.6. The program first prints <Item item2 part of <List list> at position 2>, which is wrong, and after the explicit reorder call it prints the correct <Item item2 part of <List list> at position 1>. ------------------------------------------- # -*- encoding: utf-8 -*- from sqlalchemy import create_engine, MetaData, Table, Column, Integer, Unicode, ForeignKey, UniqueConstraint from sqlalchemy.orm import sessionmaker, mapper, relation from sqlalchemy.ext.orderinglist import ordering_list metadata = MetaData()(Continue reading)
RSS Feed