Esempio n. 1
0
def account():
    user_addresses    = dict(addresses = db(db.addresses.user_id == auth.user.id).select())
    user_cards        = dict(cards = db(db.credit_cards.user_id == auth.user.id).select())
    billing_addresses = db((db.addresses.billing_address == True) & (db.addresses.user_id == auth.user.id)).select(db.addresses.ALL)

    for card in user_cards['cards']:
        # Format expiry to show in-page as MM/YY
        card.formatted_expiry = datetime.datetime.strftime(card.expiry_date, '%m/%y')
    
    return dict(
        addresses         = user_addresses['addresses'],
        credit_cards      = user_cards['cards'],
        billing_addresses = billing_addresses,
        all_months        = custom_functions.get_months(),
        all_years         = custom_functions.get_years(),
        user_age          = calculate_age(auth.user.birthdate)
    )
Esempio n. 2
0
def signup():
    return dict(
        all_months = custom_functions.get_months(),
        all_years  = custom_functions.get_years()
    )