This is the problem:
TD(A('delete!',_href=self.delete
(db.t2_comment,query=db.t2_comment.id==
row.id,next='run/pending_comments')))))
"self.delete(...)" performs the delete.
You need to:
1) create an action like
@t2.requires_login()
def delete_comment(): t2.delete(db.t2_comment,next='run/
pending_comments')
2) edit the line above and turn it to
db.t2_comment.represent=lambda row: TABLE(
TR(TD('Author'),TD('Body')),
TR(TD(row.created_signature),TD(row.body),
TD(A('approve!',_href=self.action
('approve_comment',row.id))),
TD(A('delete!',_href=t2.action
('delete_comment,row.id),next='run/pending_comments')))))
On Dec 25, 11:53 am, "Tito Garrido" <[email protected]> wrote:
> Hi folks,
>
> I'm trying to create a represent function for t2_comment using the follow
> method:
> db.t2_comment.represent=lambda row: TABLE(
> TR(TD('Author'),TD('Body')),
> TR(TD(row.created_signature),TD(row.body),
> TD(A('approve!',_href=self.action('approve_comment',
> row.id))),
>
> TD(A('delete!',_href=self.delete(db.t2_comment,query=db.t2_comment.id==
> row.id,next='run/pending_comments')))))
>
> But when I try to renderize this itemize its deletes all posts...
>
> am I doing something wrong?
>
> Thanks,
>
> Tito
>
> --
> Linux User #387870
> .........____
> .... _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:_______
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---