Support for related name in relationships declaration
sdispater opened this issue · comments
Sébastien Eustace commented
To avoid issues with circular references when declaring relationships, the relationship methods should support declaring the related model with its table name.
class Post(Model):
@property
def tags(self):
return self.morph_to_many('tags', 'taggable')
class Video(Model):
@property
def tags(self):
return self.morph_to_many('tags', 'taggable')
class Tag(Model):
@property
def posts(self):
return self.morphed_by_many('posts', 'taggable')
@property
def videos(self):
return self.morphed_by_many('videos', 'taggable')