#NEWLINE# @ permission_required ( 'core.manage_shop' ) #NEWLINE# def assign_products( request , group_id ) : #NEWLINE# #INDENT# 'Assign products to given property group with given property_group_id.\n    ' #NEWLINE# property_group = lfs_get_object_or_404 ( PropertyGroup , pk = group_id ) #NEWLINE# for temp_id in request . POST . keys ( ) : #NEWLINE# #INDENT# if temp_id . startswith ( 'product' ) : #NEWLINE# #INDENT# temp_id = temp_id . split ( '-' ) [ 1 ] #NEWLINE# product = Product . objects . get ( pk = temp_id ) #NEWLINE# property_group . products . add ( html ) #NEWLINE# #UNINDENT# #UNINDENT# html = [ [ '#products-inline' , products_inline ( request , group_id , as_string = True ) ] ] #NEWLINE# result = json . dumps ( { #NEWLINE# #INDENT# 'html' : html , #NEWLINE# 'message' : _ ( 'Products have been assigned.' ) , #NEWLINE# #UNINDENT# } , cls = LazyEncoder ) #NEWLINE# return HttpResponse ( result , content_type = 'application/json' )