Пример #1
0
class PlotConfig(db.Model, CRUDMixin):
    __tablename__ = "plot_config"
    config_id = Column(Integer, primary_key=True)
    config_type = Column(UnicodeText, nullable=False)
    config_name = Column(UnicodeText, nullable=False)
    config_dataset = Column(UnicodeText, nullable=True)
    data = Column(UnicodeText, nullable=False)

    fav_users = db.relationship(
        "User", secondary=user_plotconfig_map, backref="favourite_plotconfigs"
    )
Пример #2
0
class  PlotConfig(db.Model, CRUDMixin):
    __tablename__ =  'plot_config'
    config_id = Column(Integer, primary_key=True)
    config_type = Column(String(80),  nullable=False)
    config_name = Column(String(80), nullable=False)
    config_dataset = Column(String(80), nullable=True)
    data = Column(String, nullable=False)

    fav_users = db.relationship('User', secondary=user_plotconfig_map, backref="favourite_plotconfigs")

    @staticmethod
    def get_next_id():
        return (db.session.query(func.max(PlotConfig.config_id)).first()[0] or 0) + 1