def db_asset_add(**kwargs):
 group_id_list = kwargs.pop('groups')
 asset = Asset(**kwargs)
 asset.save()
 group_select = []
 for group_id in group_id_list:
  group = AssetGroup.objects.filter(id=group_id)
  group_select.extend(group)
 asset.group = group_select

def db_asset_add ( ** kwargs ) : group_id_list = kwargs . pop ( 'groups' ) asset = Asset ( ** kwargs ) asset . save ( ) group_select = [ ] for group_id in group_id_list : group = AssetGroup . objects . filter ( id = group_id ) group_select . extend ( group ) asset . group = group_select
add asset to db .