You can reference a user with

Field('user_id','reference auth_user')

Anyway. You should never ask the users to input their credit cards on your 
web site. If you do than you have to comply with PCI and it may be very 
expensive. If you need to accept credit cards look into stripe.com and the 
example code in web2py gluon/contrib/stripe.py

It allows to generate the input form without the card information and 
processing every going through your web site. You are automatically PCI 
compliant. Web2py generates all the code you need. I was planning to post 
an example.

Massimo



On Saturday, 19 October 2013 15:37:06 UTC-5, Cody Scott wrote:
>
> I'm trying to associate a table to a user and query for records for that user 
> in the table.
>
>
> db = DAL("sqlite://storage.sqlite")
>  from gluon.tools import Authauth = Auth(db)auth.define_tables()
>  db.define_table('credit_card',
>     Field('name', notnull=True, label=T('Card Name')),
>     Field('interest_rate', notnull=True, label=T('Interest Rate (%)')),
>     # balance?
>     #TODO: accept commas
>     # I guess it is a string
>     Field('amount', notnull=True, label=T('Amount Owing')),
>     Field('minimum_payment_amount', label=T('Minimum Payment Amount')),
>     Field('minimum_payment_percent', label=T('Minimum Payment Percent')),
>     Field('annual_fee', label=T('Annual Fee')),
>     Field('created_by', db.auth_user, default=auth.user_id))
>  # How would I get a list of all credit cards for a visitorincome_list = 
> db.income(db.income.created_by=auth.user.id)# how would I get a sum of all 
> the minimum payments in a query?
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to