I would like to get the specific information from different model therefore I have use the method of select_related to fetch the data but I unable to save the record into db. How to use select_related in save method?
Let say I have following models models.py
Now I would like to get the product_quantity from stocklist and do a subtraction between product_quantity and shipping_qty(from stockOut models) to get the final quantity that remain.
But I unable to save/update the value into db when I use the method of select_related to get the specific information. How would I go about doing this? Thanks.
first of all you don't get only
shipping_qtyif you dostockOut.objects.all().select_related("shipping_qty")but you get all stockOut instances with their shipping_qty and stockswhat you want is, to get these values for only the current instance