donation model
This commit is contained in:
parent
3be578174f
commit
b186239f04
4 changed files with 17 additions and 0 deletions
|
|
@ -11,4 +11,5 @@ class Campaign(db.Model):
|
|||
__tablename__ = 'campaign'
|
||||
id = Column('id', INTEGER(), primary_key=True)
|
||||
title = Column('title', TEXT(), nullable=False)
|
||||
donation_id = Column(INTEGER, ForeignKey('donation.id'))
|
||||
#ambassadors
|
||||
15
app/main/models.py
Normal file
15
app/main/models.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
from app import db
|
||||
from flask import current_app
|
||||
from flask_login import UserMixin, current_user
|
||||
from sqlalchemy import TEXT, Column, Boolean, ForeignKey, TEXT, INTEGER, VARCHAR
|
||||
import jwt
|
||||
from datetime import datetime, timezone, timedelta
|
||||
|
||||
|
||||
class Donation(db.Model):
|
||||
__tablename__ = 'donation'
|
||||
id = Column('id', INTEGER(), primary_key=True, autoincrement=True)
|
||||
currency_type = Column('currency_type', TEXT(), nullable=False)
|
||||
amount = Column('amount', INTEGER(), nullable=False)
|
||||
campaign = db.relationship('Campaign', backref='Donation', lazy='dynamic')
|
||||
user = db.relationship('User', backref='Donation', lazy='dynamic')
|
||||
|
|
@ -14,6 +14,7 @@ class User(db.Model, UserMixin):
|
|||
email = Column('email', TEXT(), nullable=False, unique=True)
|
||||
password = Column('password', TEXT(), nullable=False)
|
||||
user_type = Column('user_type', TEXT(), nullable=False)
|
||||
donation_id = Column(INTEGER, ForeignKey('donation.id'))
|
||||
|
||||
def get_reset_token(self, expiration=600):
|
||||
reset_token = jwt.encode(
|
||||
|
|
|
|||
0
python_files/db_population.py
Normal file
0
python_files/db_population.py
Normal file
Loading…
Add table
Add a link
Reference in a new issue