This piece of code is placed at the end of my purchase process. Once the user paid successfully, I want to verify at the end, if a discount code was used. If so, I want to delete the discount code session. When the user returns to the event / product page, he has to write the discount again, in case he wants to use it.
Is there a better way to verify the session first and then delete it?
# If configured, remove discount cookie discount_code_session_name = & # 39; discount_code _ & # 39; + str ( self.order_items_dict['event'].pk ) discount_code_session = request.session.get (discount_code_session_name, None) yes discount_code_session: of the request.session[discount_code_session_name]