def supply_item_controller():
 s3 = current.response.s3
 s3db = current.s3db
 def prep(r):
  if r.component:
   if (r.component_name == 'inv_item'):
    s3db.configure('inv_inv_item', listadd=False, deletable=False)
    inv_item_pack_requires = IS_ONE_OF(current.db, 'supply_item_pack.id', s3db.supply_item_pack_represent, sort=True, filterby='item_id', filter_opts=(r.record.id,))
    s3db.inv_inv_item.item_pack_id.requires = inv_item_pack_requires
   elif (r.component_name == 'req_item'):
    s3db.configure('req_req_item', listadd=False, deletable=False)
  elif (r.representation == 'xls'):
   s3db.supply_item.item_category_id.represent = supply_ItemCategoryRepresent(use_code=False)
  return True
 s3.prep = prep
 return current.rest_controller('supply', 'item', rheader=supply_item_rheader)

def supply_item_controller ( ) : s3 = current . response . s3 s3db = current . s3db def prep ( r ) : if r . component : if ( r . component_name == 'inv_item' ) : s3db . configure ( 'inv_inv_item' , listadd = False , deletable = False ) inv_item_pack_requires = IS_ONE_OF ( current . db , 'supply_item_pack.id' , s3db . supply_item_pack_represent , sort = True , filterby = 'item_id' , filter_opts = ( r . record . id , ) ) s3db . inv_inv_item . item_pack_id . requires = inv_item_pack_requires elif ( r . component_name == 'req_item' ) : s3db . configure ( 'req_req_item' , listadd = False , deletable = False ) elif ( r . representation == 'xls' ) : s3db . supply_item . item_category_id . represent = supply_ItemCategoryRepresent ( use_code = False ) return True s3 . prep = prep return current . rest_controller ( 'supply' , 'item' , rheader = supply_item_rheader )
restful crud controller .