Last active
August 29, 2015 14:27
-
-
Save heejongahn/8fb4707fc7e02d6bdad8 to your computer and use it in GitHub Desktop.
model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trans_tags = db.Table('trans_tags', | |
db.Column('history_id', db.Integer, db.ForeignKey('trans_history.id')), | |
db.Column('tag_id', db.Integer, db.ForeignKey('trans_tag.id')), | |
) | |
class TransHistory(db.Model): | |
id = db.Column(db.Integer, primary_key=True) | |
datetime = db.Column(db.DateTime) | |
conductor = db.Column(db.String(20)) | |
tags = db.relationship('TransTag', secondary = 'trans_tags', backref = 'describes') | |
def __init__(self, conductor): | |
self.datetime = datetime.now() | |
self.conductor = conductor | |
class TransTag(db.Model): | |
id = db.Column(db.Integer, primary_key=True) | |
tag_name = db.Column(db.String(20), unique=True) | |
def __init__(self, tag_name): | |
self.tag_name = tag_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment