Exemple #1
0
class Login(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(80))
    email = db.Column(db.String(120), unique=True, nullable=False)
    password = db.Column(db.String(80), nullable=False)
    phone = db.Column(db.String(80), default='NULL')
    address = db.Column(db.String(80), default='NULL')
    status = db.Column(db.String(80), default='NULL')
    image_file = db.Column(db.String(20),
                           nullable=False,
                           default='default.jpg')
    usertype = db.Column(db.String(80), nullable=False)

    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 Login.query.get(user_id)
Exemple #2
0
class Cart(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    sowner = db.Column(db.String)
    uowner = db.Column(db.String)
    name = db.Column(db.String(200))
    brand = db.Column(db.String(200))
    price = db.Column(db.String(200))
    image = db.Column(db.String(20), nullable=False, default='default.jpg')
    desc = db.Column(db.String(200))
Exemple #3
0
class Materials(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    owner = db.Column(db.String)
    name = db.Column(db.String(200))
    brand = db.Column(db.String(200))
    price = db.Column(db.String(200))
    image = db.Column(db.String(20), nullable=False, default='default.jpg')
    status = db.Column(db.String(200))
    desc = db.Column(db.String(200))
Exemple #4
0
class Feedback(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.VARCHAR)
    email = db.Column(db.VARCHAR)
    phone = db.Column(db.Integer)
    subject = db.Column(db.VARCHAR)
    message = db.Column(db.VARCHAR)
    usertype = db.Column(db.VARCHAR)
Exemple #5
0
class Pay(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    buyid = db.Column(db.String)
    name = db.Column(db.String(200))
    card = db.Column(db.String(200))
    cvv = db.Column(db.String(200))
    validdate = db.Column(db.String(200))
Exemple #6
0
class Credit(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    buyid = db.Column(db.String)
    name = db.Column(db.String(200))
    card = db.Column(db.String(200))
    cvv = db.Column(db.String(200))
    expdate = db.Column(db.String(200))
Exemple #7
0
class Buy(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    sowner = db.Column(db.String)
    uowner = db.Column(db.String)
    name = db.Column(db.String(200))
    brand = db.Column(db.String(200))
    price = db.Column(db.String(200))
    image = db.Column(db.String(20), nullable=False, default='default.jpg')
    desc = db.Column(db.String(200))
    qnty = db.Column(db.String(200))
    status = db.Column(db.String(200))
    deliname = db.Column(db.String(200))
    deliaddress = db.Column(db.String(200))
    delimobile = db.Column(db.String(200))
    payment = db.Column(db.String(200))
    delivery = db.Column(db.String(200))
Exemple #8
0
class Gallery(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.VARCHAR)
    img = db.Column(db.String(20), nullable=False, default='default.jpg')