def group_membership():
 s3db.hrm_configure_pr_group_membership()
 table = db.pr_group_membership
 gtable = db.pr_group
 htable = s3db.hrm_human_resource
 s3.filter = ((((gtable.system == False) & (gtable.group_type == 3)) & (htable.type == 1)) & (htable.person_id == table.person_id))
 def prep(r):
  if (r.method in ('create', 'create.popup', 'update', 'update.popup')):
   person_id = get_vars.get('~.person_id', None)
   if person_id:
    field = table.person_id
    field.default = person_id
    field.readable = field.writable = False
  return True
 s3.prep = prep
 output = s3_rest_controller('pr', 'group_membership', csv_stylesheet=('hrm', 'group_membership.xsl'), csv_template='group_membership')
 return output

def group_membership ( ) : s3db . hrm_configure_pr_group_membership ( ) table = db . pr_group_membership gtable = db . pr_group htable = s3db . hrm_human_resource s3 . filter = ( ( ( ( gtable . system == False ) & ( gtable . group_type == 3 ) ) & ( htable . type == 1 ) ) & ( htable . person_id == table . person_id ) ) def prep ( r ) : if ( r . method in ( 'create' , 'create.popup' , 'update' , 'update.popup' ) ) : person_id = get_vars . get ( '~.person_id' , None ) if person_id : field = table . person_id field . default = person_id field . readable = field . writable = False return True s3 . prep = prep output = s3_rest_controller ( 'pr' , 'group_membership' , csv_stylesheet = ( 'hrm' , 'group_membership.xsl' ) , csv_template = 'group_membership' ) return output
membership controller - uses the group_membership table from pr .