as introduced by Massimo I'd go for managing it through callbacks. web2py.com/books/default/chapter/29/06#before-and-after-callbacks
On Sunday, April 28, 2013 8:25:24 PM UTC+2, Simon Carr wrote: > > Massimo, > > A User creates a task and wants to assign multiple other users to the task > in order to discharg it. The user will use a mult select list to choose > users to assign to the task. She then clicks an "Assign Workers" button. > The function for that button will read the selected user in the list and > link them to the task. > > My initial thought was just to do a delete on the user_task table for any > records with this tasks id and then cycle through the selected users and > add them. This way I also remove users that are no longer to be assigned to > the task, but I was not sure if it is better to let gluon maintain this > table, hence the question is there already a way that gluon does this for > us? > > Many thanks > Simon > > On Sunday, 28 April 2013 15:40:04 UTC+1, Massimo Di Pierro wrote: >> >> You probably want to use something like >> db.task._after_insert.append(lambda fields,id: ......) But I cannot say >> more without a better understanding of your workflow. Can you provide a >> more complete use-case? >> >> On Sunday, 28 April 2013 03:44:44 UTC-5, Simon Carr wrote: >>> >>> Hi All, >>> >>> It's been a while since I have posted on here, but have just started a >>> new project with Python and PyQt4. Because of my positive experience with >>> web2py in the past I wanted to make use of Gluon for the DAL in my app. >>> >>> So I have two table that I want a many to many relationship with. >>> >>> user >>> task >>> >>> I have created a third table >>> >>> user_task >>> -id_user >>> -id_task >>> >>> When I create a new task and assign it to many users do I have to update >>> user_task manually or is there a way for gluon to automate this? >>> >>> Thanks >>> Simon >>> >> -- --- 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.

