Replies: 1 comment 4 replies
-
Try this: class AbstractStage(db.Entity):
id = PrimaryKey(int, auto=True)
needed_messages = Required(int)
message = Required(str)
class Meta:
abstract = True
def __str__(self):
return self.name
class GiveawayStage(AbstractStage):
winners = Required(int) This works the same way as Django. It won't create a table for abstract classes. The derived class will use the inherited properties to create a table. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In PonyORM when you try deriving models you get a single table.
Example PonyORM model:
It then creates following table
In Tortoise when you derive a model from another, you get a completely new table. Is there a way to obtain the same behaviour as with PonyORM? Or do I have to do it manually by creating a tagged model with enum field?
Beta Was this translation helpful? Give feedback.
All reactions