コード例 #1
0
class Modality(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(20), nullable=False)
    fee = db.Column(db.Float, default=0.0, nullable=False)
    sex = db.Column(db.String(1), nullable=False)
    sales = db.relationship('Sales',
                            backref=db.backref('modality_sales'),
                            lazy='joined')
コード例 #2
0
class Ticket(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    code = db.Column(db.String(100), nullable=True)
    staus = db.Column(db.Integer, default=0, nullable=True)
    amount = db.Column(db.Integer, nullable=False)
    price = db.Column(db.Float, nullable=False)
    lot = db.Column(db.String(20), nullable=True)
    event_id = db.Column(db.Integer,
                         db.ForeignKey('event.id',
                                       ondelete='CASCADE',
                                       onupdate='CASCADE'),
                         nullable=False)
    distributions = db.relationship('Distributions',
                                    backref=db.backref('ticket_distributions'),
                                    lazy='dynamic')
    sales = db.relationship('Sales',
                            backref=db.backref('ticket_sales'),
                            lazy='joined')
コード例 #3
0
class Product(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(100), nullable=False)
    description = db.Column(db.String(280), nullable=True)
    amount = db.Column(db.Float, nullable=False)
    size = db.Column(db.String(15), nullable=False)
    color = db.Column(db.String(15), nullable=True)
    event_id = db.Column(db.Integer,
                         db.ForeignKey('event.id',
                                       ondelete='CASCADE',
                                       onupdate='CASCADE'),
                         nullable=False)
    bought = db.relationship('Bought',
                             uselist=False,
                             backref=db.backref('product_bought'),
                             lazy='joined')
    sell = db.relationship('Sell',
                           uselist=False,
                           backref=db.backref('product_sell'),
                           lazy='joined')
コード例 #4
0
class Person(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(200), nullable=False)
    email = db.Column(db.String(100), unique=True, nullable=False)
    cpf = db.Column(db.String(15), unique=True, nullable=False)
    rg = db.Column(db.String(15), nullable=False)
    phone = db.Column(db.String(15), unique=True, nullable=False)
    course = db.Column(db.String(10), nullable=False)
    partner = db.Column(db.Integer, nullable=False)
    sex = db.Column(db.String(45), nullable=False)
    birth = db.Column(db.Date, nullable=False)
    password = db.Column(db.String(200), nullable=True)
    post = db.Column(db.String(100), nullable=True)
    salesperson = db.relationship('Salesperson',
                                  uselist=False,
                                  backref=db.backref('person_salesperson'),
                                  lazy='joined')
    student = db.relationship('Student',
                              uselist=False,
                              backref=db.backref('person_student'),
                              lazy='joined')
コード例 #5
0
class Event(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(45), nullable=False)
    starting_date = db.Column(db.Date, nullable=False)
    ending_date = db.Column(db.Date, nullable=False)
    price = db.Column(db.Float, nullable=False)
    product = db.relationship('Product',
                              backref=db.backref('event_product'),
                              lazy='dynamic')
    competition = db.relationship('Modality',
                                  secondary='competition',
                                  backref=db.backref('event_competition'),
                                  lazy='dynamic')
    ticket = db.relationship('Ticket',
                             backref=db.backref('ticket'),
                             lazy='joined')