class Task(db.Model): id = db.Column(db.INTEGER, primary_key=True) task_title = db.Column(db.String(50),nullable=False) task_desc = db.Column(db.String(120), nullable=False) created_on = db.Column(db.DateTime, nullable=False) done = db.Column(db.Boolean, nullable=False) user_id = db.Column(db.INTEGER,db.ForeignKey('user.id'), nullable=False)
class User(db.Model): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(100), default='', nullable=False) email = db.Column(db.String(100), unique=True, nullable=False) _password = db.Column('password', db.String(100), nullable=False) def _get_password(self): return self._password def _set_password(self, password): if password: password = password.strip() self._password = generate_password_hash(password) password_descriptor = property(_get_password, _set_password) password = synonym('_password', descriptor=password_descriptor) def check_password(self, password): password = password.strip() if not password: return False return check_password_hash(self.password, password) @classmethod def authenticate(cls, query, email, password): user = query(cls).filter(cls.email == email).first() if user is None: return None, False return user, user.check_password(password) def __repr__(self): return u'<User id={self.id} email={self.email!r}>'.format(self=self)
class Todo(db.Model): id = db.Column(db.Integer, primary_key=True) task = db.Column(db.Text(), nullable=False) owner = db.Column(db.String(225)) status = db.Column(db.String(100)) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) def __init__(self, data): self.id = data.get('id') self.task = data.get('task') self.owner = data.get('owner') self.user_id = data.get('user') self.status = data.get('status') def save(self): db.session.add(self) db.session.commit() return self.id @classmethod def get_task(cls, task_id): return cls.query.get(task_id) @property def serialize(self): return { "id": self.id, "task": self.task, "owner": self.owner, "status": self.status, "creator": self.user_id }
class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(80), unique=True) email = db.Column(db.String(120), unique=True) bookmarks = db.relationship('Bookmark', backref='user', lazy='dynamic') password_hash = db.Column(db.String(300)) def get_reset_token(self, expires_sec=1800): s = Serializer(app.secret_key, expires_sec) return s.dumps({'user_id': self.id}).decode('utf-8') @staticmethod def verify_reset_token(token): s = Serializer(app.secret_key) try: user_id = s.loads(token)['user_id'] except: return None return User.query.get(user_id) @property def password(self): raise AttributeError('password: write only-field') @password.setter def password(self, password): self.password_hash = generate_password_hash(password) def check_password(self, password): return check_password_hash(self.password_hash, password) @staticmethod def get_by_username(username): return User.query.filter_by(username=username).first()
class User(db.Model, BaseModel): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(128), unique=True) password = db.Column(db.String(256)) email = db.Column(db.String(128), unique=True) info = db.relationship('UserInfo', backref='owner') created_at = db.Column(db.DateTime, default=datetime.datetime.utcnow) # todos = db.relationship('Todo', backref='owner') def __repr__(self): return '<User: %r>' % self.username def __str__(self): return self.username def set_password(self, password): self.password = generate_password_hash( password, method=current_app.config['PASSWORD_HASH_ALGORITHM'], salt_length=current_app.config['PASSWORD_HASH_LENGTH'], ) def verify_password(self, password): return check_password_hash(self.password, password)
class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(20), unique=True, nullable=False) email = db.Column(db.String(120), unique=True, nullable=False) image_file = db.Column(db.String(20), nullable=False, default='default.jpg') password = db.Column(db.String(60), nullable=False) tasks = db.relationship('Todo', backref='owner', lazy=True) def get_reset_token(self, expires_sec=1800): s = Serializer(app.config['SECRET_KEY'], expires_sec) return s.dumps({"user_id": self.id}).decode('utf-8') @staticmethod def verify_reset_token(token): s = Serializer(app.config['SECRET_KEY']) try: user_id = s.loads(token)["user_id"] except: return None return User.query.get(user_id) def __repr__(self): return f"User('{self.username}', '{self.email}', '{self.image_file}')"
class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(30), unique=True, nullable=False) password = db.Column(db.String(100), nullable=False) todo_posts = db.relationship('Todo', backref='author', lazy=True) def __repr__(self): return f'({self.username})'
class Admins(db.Model): Id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(120), unique=True, nullable=False) password = db.Column(db.String(60), nullable=False) firstName = db.Column(db.String(30), nullable=False) lastName = db.Column(db.String(30), nullable=False) def __repr__(self): return 'Admin<{}>'.format(self.email)
class Todo(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(50), nullable=False) content = db.Column(db.String(200), nullable=False) completed = db.Column(db.Integer, default=0) created_date = db.Column(db.DateTime, default=datetime.utcnow) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) def __repr__(self): return '<Task %r>' % self.title
class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(20), unique=True, nullable=False) email = db.Column(db.String(120), nullable=False) image_file = db.Column(db.String(20), nullable=False, default="default.jpg") password = db.Column(db.String(60), nullable=False) tasks = db.relationship("Tasks", backref="user", lazy=True, passive_deletes=True) def __repr__(self): return f"User('{self.username}', '{self.email}', '{self.image_file}')"
class Todo(db.Model): # cree une table Todo avec different attribue ci-dessus id = db.Column(db.Integer(), primary_key=True) name = db.Column(db.String(length=30), nullable=False) category = db.Column( db.String(length=30), nullable=False, ) share = db.Column(db.Boolean(), nullable=False, default=False) owner = db.Column(db.Integer(), db.ForeignKey('user.id')) date_added = db.Column(db.DateTime, default=datetime.datetime.utcnow)
class UserTodo(db.Model): id = db.Column(db.Integer, primary_key = True) todo_item = db.Column(db.String) item_due_date = db.Column(db.String(10)) todo_item_note = db.Column(db.String(300)) create_date = db.Column(db.DateTime) user_id = db.Column(db.Integer, db.ForeignKey('user.id')) def __repr__(self): return '<UserTodo %r>' % (self.todo_item)
class Todo(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(100), nullable=False) subject = db.Column(db.String(100), nullable=False) date = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow) content = db.Column(db.Text, nullable=False) user_id = db.Column( db.Integer, db.ForeignKey("user.id", ondelete="CASCADE"), nullable=False ) task = db.relationship("Tasks", backref="todo", lazy=True, passive_deletes=True) def __repr__(self): return f"Todo('{self.id}' '{self.title}','{self.subject}','{self.date}','{self.content}','{self.user_id}')"
class Tasks(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(100), nullable=False) adddate = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow) duedate = db.Column(db.DateTime) label = db.Column(db.String(100), nullable=False) priority = db.Column(db.String(100), nullable=False) status = db.Column(db.String(100), nullable=False) user_id = db.Column( db.Integer, db.ForeignKey("user.id", ondelete="CASCADE"), nullable=False ) def __repr__(self): return f"Todo('{self.id}' '{self.title}','{self.adddate}','{self.duedate}','{self.user_id}','{self.label}','{self.priority}','{self.status}')"
class Users(db.Model): Id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(30), unique=True, nullable=False) firstName = db.Column(db.String(20), nullable=False) lastName = db.Column(db.String(20), nullable=False) email = db.Column(db.String(120), nullable=False, unique=True) password = db.Column(db.String(60), nullable=False) lists = db.relationship('Lists', backref='username', lazy=True, cascade='all') def __repr__(self): return f'User("{self.email}", "{self.lastName}, {self.firstName}", "{self.username}")'
class UserInfo(db.Model): __tablename__ = 'userinfo' id = db.Column(db.Integer, primary_key=True) user = db.Column(db.ForeignKey('users.id')) sex = db.Column(db.Boolean, nullable=True) first_name = db.Column(db.String(128), nullable=True) last_name = db.Column(db.String(128), nullable=True) phone_number = db.Column(db.String(11), nullable=True) picture = db.Column(db.String(256), nullable=True) birthday = db.Column(db.DateTime, default=datetime.datetime.utcnow) updated_at = db.Column(db.DateTime, default=datetime.datetime.utcnow) def __repr__(self): return '<UserInfo: %d, %r>' % (self.id, self.owner)
class User(UserMixin, db.Model): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(60), unique=True, nullable=False) password_hash = db.Column(db.String(128)) missions = db.relationship('Mission', backref='author', lazy='dynamic') def set_password(self, password): self.password_hash = generate_password_hash(password) def check_password(self, password): return check_password_hash(self.password_hash, password) def __repr__(self): return '<User {}>'.format(self.username)
class Subtask(db.Model): Subid = db.Column(db.Integer, primary_key=True, autoincrement=True) SubTitle = db.Column(db.String(100), nullable=False) SubDueDate = db.Column(db.Date, nullable=False, default=datetime.utcnow) SubDescription = db.Column(db.String(100), nullable=False) UnderTitle = db.Column(db.Integer, db.ForeignKey('task.TitleId'), nullable=False) SubStatus = db.Column(db.Boolean, default=True) def __repr__(self): return "Subtask('{}','{}', '{}','{}','{}','{}')".format( self.Subid, self.SubTitle, self.SubDueDate, self.SubDescription, self.SubStatus, self.UnderTitle)
class User(db.Model): __tablename__ = "user" id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(20), unique=True, nullable=False) email = db.Column(db.String(120), unique=True, nullable=False) password = db.Column(db.String(60), nullable=False) notes = db.relationship('Note', backref="author") def __init__(self, name, email, password): self.name = name self.email = email self.password = password def __repr__(self): return f"User('{self.id}','{self.name}','{self.email}', {self.notes})"
class Task(db.Model): TitleId = db.Column(db.Integer, primary_key=True) Title = db.Column(db.String(20), unique=True, nullable=False) Description = db.Column(db.String(20), nullable=False) Status = db.Column(db.Boolean, default=True) DueDate = db.Column(db.Date, nullable=False, default=datetime.now) AlertTime = db.Column(db.Integer, default=24) Is_delete = db.Column(db.Boolean, default=False) DeleteDate = db.Column(db.Date, default='') subtask = db.relationship('Subtask', lazy=True) def __repr__(self): return "Task('{}', '{}','{}','{}','{}','{}','{}','{}')".format( self.TitleId, self.Title, self.Description, self.Status, self.DueDate, self.AlertTime, self.Is_delete, self.DeleteDate)
class TodoCard(db.Model): __tablename__ = 'todo_card' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(60), index=True) active = db.Column(db.Boolean, default=True, index=True) status = db.Column(db.String(60), index=True, default='draft') todo = db.relationship('Todo', backref='todo_card', lazy='dynamic') user_id = db.Column(db.Integer, db.ForeignKey('todo_user.id')) @property def items(self): return Todo.query.filter(Todo.todo_card_id == self.id).order_by( Todo.d_create).all()
class Tasks(db.Model): Id = db.Column(db.Integer, primary_key=True) taskName = db.Column(db.String(100), nullable=False, unique=True) status = db.Column(db.Boolean, default=False) tid = db.Column(db.Integer, db.ForeignKey('lists.Id', ondelete='CASCADE'), nullable=False)
class TaskList(db.Model): id = db.Column(db.Integer, primary_key=True) task_name = db.Column(db.String(140)) task_status = db.Column(db.Integer, default=0) date_created = db.Column(db.DateTime, index=True, default=datetime.utcnow) user_id = db.Column(db.Integer, db.ForeignKey('user.id')) def __repr__(self): return '<{}>'.format(self.task_name)
class User(ProjectUserMixin, CharacterMixin, db.Model): __tablename__ = 'todo_user' id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(50), unique=True, nullable=False) password = db.Column(db.String(250)) first_name = db.Column(db.String(250)) last_name = db.Column(db.String(250)) active = db.Column(db.Boolean, default=True) d_create = db.Column(db.DateTime(timezone=True)) todo_card = db.relationship('TodoCard', backref='user', lazy='dynamic') todo = db.relationship('Todo', backref='user', lazy='dynamic') character_id = db.Column(db.Integer, db.ForeignKey('todo_character.id')) def __str__(self): return f'<User {self.id} {self.email}>' or '---'
class Activities(db.Model): __tablename__ = 'activities' id = db.Column(db.Integer, primary_key=True) activity = db.Column(db.String(50), nullable=False) completed = db.Column(db.Boolean, default=False) todo_id = db.Column(db.Integer, db.ForeignKey('todo.id')) def __repr__(self): return f"Activities('{self.activities}')"
class Todo(db.Model): __tablename__ = 'todo' id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(50), nullable=False) completed = db.Column(db.Boolean, default=False) activities = db.relationship('Activities', backref="todo", lazy=True) def __repr__(self): return f"Todo('{self.todo_name}')"
class Tasksum(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(100), nullable=False) description = db.Column(db.Text(20000), nullable=False) date = db.Column(db.DateTime, nullable=False, default=datetime.datetime.utcnow) task_id = db.Column(db.Integer, db.ForeignKey("tasks.id"), nullable=False) def __repr__(self): return f"Task('{self.title}','{self.description}')"
class Gender(db.Model): """Модель пола""" __tablename__ = 'todo_gender' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(50), index=True) def __str__(self): return f'Gender {self.name}'
class Tag(db.Model, BaseModel): __tablename__ = 'blog_tags' id = db.Column(db.Integer, primary_key=True) post_id = db.Column(db.Integer, db.ForeignKey('blog_posts.id')) name = db.Column(db.String(128), unique=True) posts = relationship("Post", back_populates="tags") def __repr__(self): return self.name
class TODO(db.Model): """ Define the TODO app model """ __tablename__ = "todo" id = db.Column(db.Integer, primary_key=True, autoincrement=True) body = db.Column(db.String(100), default="") done = db.Column(db.Boolean, default=False)