How to add the deleted item’s quantity back in my total quantities in django?

I am designing a model of the Health Center. If I am deleting the prescribed medicines to a patient, then I want those medicines' quantity back in the total stock of that medicine.

e.g. Suppose I have total of 50 of medicine A in my stocks. If I prescribed 2 unit(quantity) of medicine A to a patient, then total remained in the stock will be 48, and suppose now I am deleting that entry, then I want total 50 stocks of medicine A back again.

How do I solve this problem. I am a beginner in Django. Any suggestions will be pra

Read more here:

Content Attribution

This content was originally published by Aditya Gupta at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: