Re: Calculated Fields

2022-04-10 Thread Antonis Christofides
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 w

Re: Calculated Fields

2022-04-10 Thread Mike Dewhirst
On 11/04/2022 2:48 pm, tech george wrote: Hello Mike, Unfortunately it's not calculating the fields as I wanted, instead it's calculating as below; reorder_level * unit_price + quantity Try using brackets like this ... self.total_price = (self.reorder_level + self.quantity) * self.unit_pric

Re: Calculated Fields

2022-04-10 Thread tech george
Hello Mike, Unfortunately it's not calculating the fields as I wanted, instead it's calculating as below; reorder_level * unit_price + quantity Which is wrong because I'm getting less amount. Regards On Mon, 11 Apr 2022, 01:56 Mike Dewhirst, wrote: > > > > > -- > (Unsigned mail from my phone

RE: Calculated Fields

2022-04-10 Thread Mike Dewhirst
--(Unsigned mail from my phone) Original message From: tech george Date: 11/4/22 03:50 (GMT+10:00) To: django-users@googlegroups.com Subject: Calculated Fields Hello,I am trying to calculate fields directly from a model but no luck. I want to get total_price from quantity, re

Calculated Fields

2022-04-10 Thread tech george
Hello, I am trying to calculate fields directly from a model but no luck. I want to get total_price from quantity, reoder_level and unit price. My code is abelow, Please advise. class Stock(models.Model): unit_price = models.DecimalField(max_digits=10, decimal_places=2, default='0', blank=Tru

Logging: set default values for custom keys in custom formatters OR choose formatter based on logger

2022-04-10 Thread M T
Hi all, I'm trying to extend the formatter for console logging with custom keys. But I've run into two problems while doing that: 1) Root log messages of course don't provide these custom keys in their extra dict, so they throw errors. Looking at the official Python documentation, it is possible

Re: Error during template rendering

2022-04-10 Thread Antonis Christofides
Hi! The error message 'relation "curriculum_standard" does not exist' has been produced by PostgreSQL, and Django merely repeats it. In other words, Django is telling you that while it was doing what it was doing, an error occurred in the RDBMS, and it is showing you the error message that the