Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class Action(ActionMixIn, db.Model):
__bind_key__ = __tablename__ = "action"
class Action_01_NotResponsed_ByMe(Action):
__bind_key__ = "action"
__tablename__ = "Action_01_NotResponsed_ByMe".lower()
id = db.Column(db.Integer, db.ForeignKey('action.id'), primary_key=True)
class Action_02_NotResponsed_ByYou(Action):
__bind_key__ = "action"
__tablename__ = "Action_02_NotResponsed_ByYou".lower()
id = db.Column(db.Integer, db.ForeignKey('action.id'), primary_key=True)
class Action_03_AskedOut(Action):
__bind_key__ = "action"
__tablename__ = "Action_03_AskedOut".lower()
id = db.Column(db.Integer, db.ForeignKey('action.id'), primary_key=True)
@minhoryang

This comment has been minimized.

Copy link
Owner Author

minhoryang commented Sep 17, 2015

Action_01_NotResponsed_ByMe
Action_02_NotResponsed_ByYou
Action_03_AskedOut
과 같은 부분을 정리하고싶습니다.
Metaclass같은걸로도 될 것 같은데, 궁금합니다.

  1. tablename의 부분에서 자신의 클래스 이름을 받아올 수 있는 방법이 있나요?
  2. Factory처럼 Action_01_NotResponsed_ByMe, Action_02_NotResponsed_ByYou, Action_03_AskedOut 등을 찍어낼 수 있나요?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.