コード例 #1
0
def initialize():
    DATABASE.connect()
    DATABASE.create_tables([User, Invoice], safe=True)
    try:
        User.create(first_name="Felician",
                    last_name="Mueni",
                    email="*****@*****.**",
                    company="Acme Corp.")
    except IntegrityError:
        pass
    try:
        Invoice.create(user_email="*****@*****.**",
                       design_fee=500,
                       hosting_fee=175,
                       domain_fee=10)
    except IntegrityError:
        pass
    DATABASE.close()
コード例 #2
0
ファイル: boostrap.py プロジェクト: assue19/invoice-database
def initialize():
    DATABASE.connect()
    DATABASE.create_tables([User, Invoice], safe=True)
    try:
        User.create(first_name="assumpter",
                    last_name="Kimeu",
                    email="*****@*****.**",
                    company="Acme Corp.")
    except IntegrityError:
        pass
    try:
        Invoice.create(user_email="*****@*****.**",
                       design_fee=500,
                       hosting_fee=175,
                       domain_fee=10,
                       developer_fee=1000)
    except IntegrityError:
        pass
    DATABASE.close()
コード例 #3
0
def initialize():
    DATABASE.connect()
    DATABASE.create_tables([User, Invoice], safe=True)
    try:
        User.create(first_name="Jane",
                    last_name="Lodipo",
                    email="*****@*****.**",
                    company="Acme Corp.")
    except IntegrityError:
        pass
    try:
        Invoice.create(user_email="*****@*****.**",
                       design_fee=500,
                       hosting_fee=200,
                       domain_fee=100,
                       developer_fee=4000)
    except IntegrityError:
        pass
    DATABASE.close()
コード例 #4
0
def initialize():
    DATABASE.connect()
    DATABASE.create_tables([User, Invoice], safe=True)
    try:
        User.create(first_name="yvonne",
                    last_name="jahenda",
                    email="*****@*****.**",
                    company="Acme Corp.")
    except IntegrityError:
        pass
    for invoice in invoices:
        try:
            Invoice.create(user_email=invoice.get('user_email'),
                           design_fee=invoice.get('design_fee'),
                           hosting_fee=invoice.get('hosting_fee'),
                           developer_fee=invoice.get('developer_fee'),
                           domain_fee=invoice.get('domain_fee'))
        except IntegrityError:
            pass
    DATABASE.close()
コード例 #5
0
def initialize():
    DATABASE.connect()
    DATABASE.create_tables([User, Invoice], safe=True)
    try:
        User.create(first_name='first_name',
                    last_name='last_name',
                    email='*****@*****.**',
                    company='Acme')
    except IntegrityError:
        pass
    for invoice in invoices:
        try:
            Invoice.create(
                user_email=invoice.get('user_email'),
                design_fee=invoice.get('design_fee'),
                hosting_fee=invoice.get('hosting_fee'),
                domain_fee=invoice.get('domain_fee'),
                dev_fee=invoice.get('dev_fee'),
            )
        except IntegrityError:
            pass
    DATABASE.close()