I am looking at Massimo's my_forum app. in function definition I have:

def do():

    id, method = request.args(0,cast=int), request.args(1)

    if method == 'report':

        db(db.post.id==id).update(reported=True)

        return 'reported'

    if method == 'like_it' and (DEBUG or auth.has_membership('moderators')):

        like = db.liked.insert(liked_by=auth.user.id)

        query1 = (db.auth_user.id == db.liked.liked_by);

        all_likes = db(query1).select(db.auth_user.first_name);

        db(db.post.id==id).update(reported=False, like_it=True,banned=False)

        return 'liked'


Basically, its a facebook like "like" that I want to replicate.


Question. 


How to return the pydal field object from controller along with the string 
'liked'.


all likes is : <pydal.objects.Field object at 0x0000000009D8E438>


My model file is:

db.define_table('liked',
                Field('thread', 'reference thread'),
                Field('liked_on', 'datetime', default=request.now, 
readable=False, writable=False),
                Field('liked_by', 'reference auth_user', readable=False, 
writable=False))





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

Reply via email to