# HG changeset patch # User Lennard de Rijk # Date 1256198471 -7200 # Node ID 1852a74ba03ad0cd3d06a0b9cc35833a6515d675 # Parent a223fff4cca89d502a623a75b01ff86c9caa95e0 Set the Mentors list to the user that is suggesting a Task. diff -r a223fff4cca8 -r 1852a74ba03a app/soc/modules/ghop/views/models/task.py --- a/app/soc/modules/ghop/views/models/task.py Thu Oct 22 09:54:01 2009 +0200 +++ b/app/soc/modules/ghop/views/models/task.py Thu Oct 22 10:01:11 2009 +0200 @@ -629,6 +629,16 @@ else: # TODO: Redirect to standard edit page which already has the ability to # hide certain fields. + # get the mentor entity of the current user that is suggesting the task + user_entity = user_logic.logic.getForCurrentAccount() + + filter = {'user': user_entity, + 'scope': fields['scope'], + 'status': 'active'} + + mentor_entity = ghop_mentor_logic.logic.getForFields(filter, unique=True) + fields['mentors'] = [mentor_entity.key()] + entity = logic.updateOrCreateFromFields(fields) redirect = ghop_redirects.getSuggestTaskRedirect(