Default subclass objects in Sqlalchemy?
- by Timmy
im using the example from the pylons book
orm.mapper(Comment, comment_table)
orm.mapper(Tag, tag_table)
orm.mapper(Nav, nav_table, polymorphic_on=nav_table.c.type, polymorphic_identity='nav')
orm.mapper(Section, section_table, inherits=Nav, polymorphic_identity='section')
orm.mapper(Page, page_table, inherits=Nav, polymorphic_identity='page', properties={
'comments':orm.relation(Comment, backref='page', cascade='all'),
'tags':orm.relation(Tag, secondary=pagetag_table)
})
i am mostly copying from this, but is there a simple way have a default Page that gets referenced, but if users requests a change, create a new Page object? thanks
i want something similar to this
class DefaultPage(Page):
__init__(self):
self.a = a
self.b = b
self.c = c
orm.mapper(DefaultPage, None, inherits=Nav, yada yada )