ctrlSoft, I'm working in an architecture similar to yours.

See some suggestions here: https://gist.github.com/viniciusban/5355781



On Wed, Apr 10, 2013 at 12:06 PM, ctrlSoft <zerooo...@gmail.com> wrote:
>
> in model dbtables.py
> #.....
> #.....
> db.define_table('wishlist',
> Field('user_id', db.auth_user,
> requires=IS_IN_DB(db,'auth_user.id','%(username)s')),
> Field('offer_id', db.offer, requires=IS_IN_DB(db,'offer.id','%(title)s')),
> Field('created_on', type='datetime', default=request.now, writable=False))
> #.....
> #.....
>
> in modules wishlist.py  (this is just the ideea how i want to pass objects,
> i dont know how to do this correctly)
>
> from gluon import*
>
> class WishList():
> def add_to_wish_list(self,db,table,field1,value1,field2,value2): # or is
> better list of **fields,**values ?
> try:
> db.table.insert(field1=value1,field2=value2) #insert or validate_and_insert?
> return 'Successfuly added to wishlist'
> except:
> return 'Error. Try again latter'
>
>         #remove_from_wish_list()
>         #get_user_wish_list()
>         #....
>         #....
>
>
> in one of the controllers default.py
> #......
> #......
>
>
> @auth.requires_login()
> def add_to_wishlist():
> wishlist_obj = WishList()
> status_wishlist_add =
> wishlist_obj.add_to_wish_list(db,wishlist,'user_id',auth.user_id,'offer_id',requested_offer_id)
> return status_wishlist_add
>
> #......
> #......
>
>
>
> --
>
> ---
> 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 web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to