from app import create_app, db
app = create_app()
app.app_context().push()
from app.models import PurchaseOrder
po = PurchaseOrder.query.first()
if po:
    print('PO found:', po.po_number)
    try:
        proj = po.project
        print('Project:', proj)
    except AttributeError as e:
        print('AttributeError:', e)
    try:
        vend = po.vendor
        print('Vendor:', vend)
    except AttributeError as e:
        print('AttributeError:', e)
else:
    print('No PO')