Ejemplo n.º 1
0
def copyPostToForm(post):
        pf = PostForm()
        for field in pf.all_fields():
            if hasattr(post, field.name):
                setattr(pf, field.name, str(getattr(post, field.name)))
            if field.name == 'postId':
                setattr(pf, field.name, str(post.key.id()))
            #if field.name == 'date':
            #    setattr(pf, field.name, str(post.timestamp.strftime("%Y-%m-%d")))
            #if field.name == 'time':
            #    setattr(pf, field.name, str(post.timestamp.strftime("%H:%M:%S")))
            if field.name == 'timestamp':
                setattr(pf, field.name, str(post.timestamp))
            


            if field.name == 'clubphotoUrl':
                print "Reached here-1"
                #print str(post.club_id.get().picture)
                setattr(pf, field.name, post.club_id.get().photoUrl)
            if field.name == 'photoUrl':
                setattr(pf, field.name, post.photoUrl)
            if field.name == 'club_name':
                setattr(pf, field.name, post.club_id.get().name)        
            if field.name == 'club_id':
                setattr(pf, field.name, str(post.club_id.id())) 
        return pf
Ejemplo n.º 2
0
def copyPostToForm(post):
        pf = PostForm()
        for field in pf.all_fields():
            if hasattr(post, field.name):
                setattr(pf, field.name, str(getattr(post, field.name)))
            if field.name == 'postId':
                setattr(pf, field.name, str(post.key.id()))
        return pf