#NEWLINE# @ permission_required ( 'core.manage_shop' ) #NEWLINE# def save_discount_data( request , id ) : #NEWLINE# #INDENT# 'Saves discount data (via request body) to the discount with passed\n    id.\n\n    This is called via an AJAX request and returns JSON encoded data.\n    ' #NEWLINE# discount = Discount . objects . get ( pk = id ) #NEWLINE# discount_form = DiscountForm ( instance = discount , data = request . POST ) #NEWLINE# if discount_form . is_valid ( ) : #NEWLINE# #INDENT# discount_form . save ( ) #NEWLINE# #UNINDENT# return lfs . core . utils . set_message_cookie ( url = reverse ( 'lfs_manage_discount' , kwargs = { #NEWLINE# #INDENT# 'id' : id , #NEWLINE# #UNINDENT# } ) , msg = _ ( 'Discount data has been saved.' ) )