Beispiel #1
0
class ListUserModel(db.Model):
    __tablename__ = 'list_user'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    user_id = db.Column(db.Integer, db.ForeignKey(UserModel.id))
    user = db.relationship(UserModel)
    first_name = db.Column(db.String(128))
    last_name = db.Column(db.String(128))
    email = db.Column(db.String(128), unique=True)
Beispiel #2
0
class User(UserMixin, db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(30), unique=True)
    password_hash = db.Column(db.String(100))

    todos = db.relationship('Todo', backref='user')

    def __repr__(self):
        return f'<User {self.username}'
class ItemModel(db.Model):
    __tablename__ = 'item'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    description = db.Column(db.String(256), nullable=False)
    done = db.Column(db.Boolean, nullable=False)
    todo_list_id = db.Column(db.Integer, db.ForeignKey(ToDoListModel.id))
    todo_list = db.relationship(ToDoListModel)
class ToDoListModel(db.Model):
    __tablename__ = 'todo_list'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    user_id = db.Column(db.Integer, db.ForeignKey(ListUserModel.id))
    name = db.Column(db.String(64))
Beispiel #5
0
class UserModel(db.Model):
    __tablename__ = 'user'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    user_name = db.Column(db.String(64), unique=True)
    password = db.Column(db.String(64))
Beispiel #6
0
class AdminModel(db.Model):
    __tablename__ = 'admin'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    user_id = db.Column(db.Integer, db.ForeignKey(UserModel.id))
    user = db.relationship(UserModel)
    email = db.Column(db.String(128), unique=True)