import re
from sqlalchemy import event
from sqlalchemy.orm import validates
from sqlalchemy.ext.hybrid import hybrid_property
from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from instagram import db, app
from instagram.helpers.utils import validation_preparation

class Donation(db.Model):
    __tablename__ = 'donations'

    id = db.Column(db.Integer, primary_key=True)
    donor_id = db.Column(db.Integer, db.ForeignKey('users.id'),
                        nullable=False, index=True) # would modify to be nullable and if it's null, it's donated by an anonymous donor
    image_id = db.Column(db.Integer, db.ForeignKey('images.id'), # would modify to be nullable and if it's null, just say it's a deleted image (to keep record of deletion)
                        nullable=False, index=True)
    amount = db.Column(db.Numeric(), nullable=False)

    def __init__(self, donor_id, image_id, amount):
        self.donor_id = donor_id
        self.image_id = image_id
        self.amount = amount

63d63bc33b8e59f2510694065316fbd1e0698e2f
<mask token>


class Donation(db.Model):
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>

<mask token>


class Donation(db.Model):
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>

    def __init__(self, donor_id, image_id, amount):
        self.donor_id = donor_id
        self.image_id = image_id
        self.amount = amount

<mask token>


class Donation(db.Model):
    __tablename__ = 'donations'
    id = db.Column(db.Integer, primary_key=True)
    donor_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=
        False, index=True)
    image_id = db.Column(db.Integer, db.ForeignKey('images.id'), nullable=
        False, index=True)
    amount = db.Column(db.Numeric(), nullable=False)

    def __init__(self, donor_id, image_id, amount):
        self.donor_id = donor_id
        self.image_id = image_id
        self.amount = amount

import re
from sqlalchemy import event
from sqlalchemy.orm import validates
from sqlalchemy.ext.hybrid import hybrid_property
from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from instagram import db, app
from instagram.helpers.utils import validation_preparation


class Donation(db.Model):
    __tablename__ = 'donations'
    id = db.Column(db.Integer, primary_key=True)
    donor_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=
        False, index=True)
    image_id = db.Column(db.Integer, db.ForeignKey('images.id'), nullable=
        False, index=True)
    amount = db.Column(db.Numeric(), nullable=False)

    def __init__(self, donor_id, image_id, amount):
        self.donor_id = donor_id
        self.image_id = image_id
        self.amount = amount

import re
from sqlalchemy import event
from sqlalchemy.orm import validates
from sqlalchemy.ext.hybrid import hybrid_property
from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash
from instagram import db, app
from instagram.helpers.utils import validation_preparation

class Donation(db.Model):
    __tablename__ = 'donations'

    id = db.Column(db.Integer, primary_key=True)
    donor_id = db.Column(db.Integer, db.ForeignKey('users.id'),
                        nullable=False, index=True) # would modify to be nullable and if it's null, it's donated by an anonymous donor
    image_id = db.Column(db.Integer, db.ForeignKey('images.id'), # would modify to be nullable and if it's null, just say it's a deleted image (to keep record of deletion)
                        nullable=False, index=True)
    amount = db.Column(db.Numeric(), nullable=False)

    def __init__(self, donor_id, image_id, amount):
        self.donor_id = donor_id
        self.image_id = image_id
        self.amount = amount
