示例#1
0
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(20), unique=True, nullable=False)
    password = db.Column(db.String(60), nullable=False)
    watch_queue = db.relationship('Series',
                                  secondary=association_table,
                                  backref=db.backref('queue', lazy='dynamic'))
示例#2
0
class Hacknight(db.Model):
    """Hacknight model."""
    __tablename__ = 'hacknight'
    id = Column(Integer, autoincrement=True, primary_key=True)
    date = Column(Date)
    participants = db.relationship("Participant",
                                   secondary=participant_hacknight,
                                   lazy='subquery',
                                   backref=db.backref('hacknights', lazy=True))
示例#3
0
class Hacknight(db.Model):
    """Hacknight model."""

    __tablename__ = "hacknight"
    id = Column(Integer, autoincrement=True, primary_key=True)
    date = Column(Date, nullable=False, unique=True)
    participants = db.relationship(
        "Participant",
        secondary=participant_hacknight,
        lazy="subquery",
        backref=db.backref("hacknights", lazy=True),
    )
示例#4
0
class Team(db.Model):
    """Team model."""

    __tablename__ = "team"
    id = Column(Integer, primary_key=True)
    project_name = Column(String(50), nullable=False, unique=True)
    description = Column(Text)
    project_url = Column(String(200), unique=True)
    members = db.relationship(
        "Participant",
        secondary=participant_team,
        lazy="subquery",
        backref=db.backref("teams", lazy=True),
    )
示例#5
0
class Post(db.Model):
    __tablename__ = "post"
    __repr_attr__ = ("id", "type")

    id = db.Column(db.Integer, primary_key=True)
    body = db.Column(db.Text)
    active = db.Column(db.Boolean, default=True)

    # Type information
    type = db.relationship(PostType, secondary=type_association)

    # Connect the post to its user
    user = db.relationship(user_model,
                           secondary=user_association,
                           backref=db.backref('posts', lazy="dynamic"),
                           lazy="dynamic")