class database(db.Model): id = db.Column(db.Integer, primary_key=True) task = db.Column(db.String(20)) category = db.Column(db.String(20)) def __init__(self, task, category): self.task = task self.category = category
class User(db.Model, UserMixin): id = db.Column(db.Integer, unique=True, primary_key=True) username = db.Column(db.String(), unique=True, nullable=False) email = db.Column(db.String(), unique=True, nullable=False) password = db.Column(db.String(), nullable=False) todos = db.relationship('Todos', cascade='all, delete-orphan', backref='author', lazy=True)
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) password = db.Column(db.String(60), nullable=False) todos = db.relationship('Todo', backref="creator", lazy=True) def __repr__(self): return f"User('{self.username}', '{self.email}')"
class Todos(db.Model): id = db.Column(db.Integer, unique=True, primary_key=True) todo_item = db.Column(db.String(500), nullable=True) todo_date = db.Column(db.String(500), nullable=True) todo_status = db.Column(db.String(10), nullable=False, default='todo') done = db.Column(db.Boolean, default=False) user_id = db.Column(db.String(500), db.ForeignKey('user.email'), nullable=True) def __repr__(self): return f'Todo item {self.todo_item} due on {self.todo_date}'
class Todo(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(150), nullable=False) description = db.Column(db.Text, nullable=False) do = db.Column(db.Boolean, default=False) done = db.Column(db.Boolean, default=False) deadline = db.Column(db.DateTime, nullable=False) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
class Todo(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(150), nullable=False) description = db.Column(db.Text, nullable=False) do = db.Column(db.Boolean, default=False) done = db.Column(db.Boolean, default=False) date_posted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) deadline = db.Column(db.DateTime, nullable=False) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) def __repr__(self): return f"Todo('{self.title}', '{self.description}')"
class Task(db.Model): #A Task table __tablename__ = 'Task' id = db.Column(db.Integer, primary_key=True) #a unique identifier for each task text = db.Column(db.String(100)) #the description of the task category = db.Column(db.String(10)) #to do / doing / done
class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(15), unique=True, nullable=False) email = db.Column(db.String(80), unique=True, nullable=False) password = db.Column(db.String(40), nullable=False) todos = db.relationship('Todo', backref="creator", lazy=True)