Closed GaretJax closed 10 years ago
Thinking this through, it may be better to use the after_configured
event directly. The advantage would be that a subclass could overwrite this method without having to register the tree (or calling super) themselves.
I do not quite understand how to implement it using after_configured event. Can you show some example?
Just ended up implementing it myself. I actually never used that event before, so I had to dig in the code anyway.
I tested it on my projects. This solution works fine, thank you!
There may be an even better solution I just came across: http://docs.sqlalchemy.org/en/latest/changelog/migration_08.html?highlight=propagate#events-can-be-applied-to-unmapped-superclasses
Tree classes can automatically be registered by adding the following code to the mixin class:
This would avoid to have to call
Tree.register_tree()
after each declaration ofTree
.