Hi all,
I have those two classes:
class Playlist(rdb.Model):
"""Represents playlist. It may contain playlist items"""
rdb.metadata(metadata)
rdb.tablename("playlists")
id = Column("id", Integer, primary_key=True)
title = Column("title", String(50))
pending = Column("pending", Boolean)
items = relationship("PlaylistItem", cascade="all, delete",
backref="playlists")
screens = relationship("Screen", secondary=playlist_screens,
backref="playlists")
class PlaylistItem(rdb.Model):
"""Represents a playlist of items in Schedule page"""
rdb.metadata(metadata)
rdb.tablename("playlist_items")
id = Column("id", Integer, primary_key=True)
title = Column("title", String(50))
runtime = Column("runtime", Integer)
layoutId = Column("layout_id", Integer, ForeignKey("layouts.id"))
playlistId = Column("playlist_id", Integer,
ForeignKey("playlists.id"))
layout = relationship("Layout", uselist=False)
playlist = relationship("Playlist", uselist=False)
One playlist can contain many PlaylistItem and PlaylistItem could
contain layout or another playlist. The problem is when adding a
PlaylistItem to a Playlist, PlaylistItem automatically gets the id of
its parent (playlist_id). How can I avoid this?
Thanks in advance!
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.