old_contents: from app import db
  import hashlib
  
  
  class Bucketlist(db.Model):
      """This class represents the bucketlist table."""
  
      __tablename__ = 'bucketlists'
  
      id = db.Column(db.Integer, primary_key=True)
      name = db.Column(db.String(255))
      date_created = db.Column(db.DateTime, default=db.func.current_timestamp())
      date_modified = db.Column(
          db.DateTime, default=db.func.current_timestamp(),
          onupdate=db.func.current_timestamp())
  
      def __init__(self, name):
          """initialize with name."""
          self.name = name
  
      def save(self):
          db.session.add(self)
          db.session.commit()
  
      @staticmethod
      def get_all():
          return Bucketlist.query.all()
  
      def delete(self):
          db.session.delete(self)
          db.session.commit()
  
      def __repr__(self):
          return "<Bucketlist: {}>".format(self.name)
  
  
  class User(db.Model):
      """Maps to users table """
  
      __tablename__ = 'users'
      
      id = db.Column(db.Integer, primary_key=True)
      username = db.Column(db.String(256), nullable=False, unique=True)
      password = db.Column(db.String(256))
      bucketlists = db.relationship(
          'Bucketlist', order_by='Bucketlist.id')
  
      def __init__(self, username, password):
          self.username = username
          self.password = hashlib.sha512(password).hexdigest()
  
      def password_is_valid(self, password):
          """Validates user password """
          return self.password == hashlib.sha512(password).hexdigest()
  
new_contents: from app import db
  import hashlib
  
  
  class User(db.Model):
      """Maps to users table """
  
      __tablename__ = 'users'
  
      id = db.Column(db.Integer, primary_key=True)
      username = db.Column(db.String(256), nullable=False, unique=True)
      password = db.Column(db.String(256))
      bucketlists = db.relationship(
          'Bucketlist', order_by='Bucketlist.id')
  
      def __init__(self, username, password):
          self.username = username
          self.password = hashlib.sha512(password).hexdigest()
  
      def password_is_valid(self, password):
          """Validates user password """
          return self.password == hashlib.sha512(password).hexdigest()
  
  
  class Bucketlist(db.Model):
      """This class represents the bucketlist table."""
  
      __tablename__ = 'bucketlists'
  
      user = db.relationship('User')
  
      id = db.Column(db.Integer, primary_key=True)
      name = db.Column(db.String(255))
      date_created = db.Column(db.DateTime, default=db.func.current_timestamp())
      date_modified = db.Column(
          db.DateTime, default=db.func.current_timestamp(),
          onupdate=db.func.current_timestamp())
  
      def __init__(self, name):
          """initialize with name."""
          self.name = name
  
      def save(self):
          db.session.add(self)
          db.session.commit()
  
      @staticmethod
      def get_all():
          return Bucketlist.query.all()
  
      def delete(self):
          db.session.delete(self)
          db.session.commit()
  
      def __repr__(self):
          return "<Bucketlist: {}>".format(self.name)
  
subject: add relationship of user to bucketlist model