To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6253606d.1c69fb81.ac7f2.09bcSMTPIN_ADDED_MISSING%40gmr-mx.google.com.
Hello Mike,
Unfortunately it's not calculating the fields as I wanted, instead it's calculating as below;reorder_level * unit_price + quantity
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADYG20Ec5fq2WJLsuTiaCLycc%2B%2B%3DM7iscYVf1PbvfyDEqhtPow%40mail.gmail.com.
-- Signed email is an absolute defence against phishing. This email has been signed with my private key. If you import my public key you can automatically decrypt my signature and be sure it came from me. Just ask and I'll send it to you. Your email software can handle signing.
As was found out with the conversation with Mike Dewhirst, the error appears to be because of wrong understanding of operator precedence. That's easy to correct with parentheses.
Except for that, I wouldn't do it that way; I wouldn't store the total price in the database, because it's likely to create problems. Models that have not (yet) been saved to the database will not have a total price. Models that have been loaded from the database, modified, but not (yet) updated in the database will have a wrong total price. Saving to the database with bulk operations or with plain SQL may result in no total price. These are all symptoms of storing redundant information in the database, which is something that should be avoided.
Instead, I would do this:
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8efea23c-52d8-6ac1-b94e-3cb9ad46d086%40antonischristofides.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADYG20Ec5fq2WJLsuTiaCLycc%2B%2B%3DM7iscYVf1PbvfyDEqhtPow%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6253606d.1c69fb81.ac7f2.09bcSMTPIN_ADDED_MISSING%40gmr-mx.google.com.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f4ac9610-cb05-21a0-ade5-260573bddb9e%40stacktrace.dk.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8f8efa76-713f-86c8-ed18-188482af2882%40stacktrace.dk.