python - How to set non-model field property to all the objects in ManyToMany Relation? -
i have django model, manytomany relation, , through recursive function trying set custom property on main model , models in manytomany fields, manytomany related model property not getting reflected templates. here code snippet: def update_product_price_details(product): product.sale_price = product.original_price if product.product_type == "packaged_product": product_discount = productservices.get_product_discount(product) # todo : handle multiple items # calculate product sale price base on subproducts , disocunt product.original_price = 0 sub_product in product.packagedproduct.sub_products.all(): sub_product = productservices.update_product_price_details(sub_product) product.original_price = product.original_price + sub_product.sale_price if product_discount , product_discount.is_valid(): product.sale_price = product.original_price - (prod...