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

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
t; -- > (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 directl

Re: Calculated Fields

2022-04-10 Thread Mike Dewhirst
Apr 2022, 01:56 Mike Dewhirst, wrote: -- (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

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-11 Thread tech george
Hello Antonis, Thanks for the advice and the solution, That solved my issue. Thanks again. On Mon, Apr 11, 2022 at 9:04 AM Antonis Christofides < anto...@antonischristofides.com> wrote: > As was found out with the conversation with Mike Dewhirst, the error > appears to be because of wrong unde

Re: Calculated Fields

2022-04-11 Thread Jet Ezra
ed 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 t

Re: Calculated Fields

2022-04-11 Thread Ahmedrufai Otuoze
gt; 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, reoder_level and u

Re: Calculated Fields

2022-04-13 Thread harsh jain
; On Sun, Apr 10, 2022, 11:56 PM Mike Dewhirst > wrote: > >> >> >> >> >> -- >> (Unsigned mail from my phone) >> >> >> >> Original message >> From: tech george >> Date: 11/4/22 03:50 (GMT+10:00) &g

Re: Calculated Fields

2022-04-13 Thread Kasper Laudrup
On 13/04/2022 07.20, harsh jain wrote: Hi, This course will help you surely - https://geekster.in/ Stop spamming. This is *not* the way to attract potential clients. I would never ever consider using your company for anything and I hope others feel the same. -- You received this message be

Re: Calculated Fields

2022-04-13 Thread Ahmedrufai Otuoze
This is not a spam. I just tok a course on that aspect and wanted to help. No strings attached. I may have gone against the policy and that's because I wasn't aware. My intentions were genuine... On Wed, 13 Apr 2022 at 12:08, Kasper Laudrup wrote: > On 13/04/2022 07.20, harsh jain wrote: > > Hi

Re: Calculated Fields

2022-04-13 Thread Kasper Laudrup
On 13/04/2022 16.51, Ahmedrufai Otuoze wrote: This is not a spam. I just tok a course on that aspect and wanted to help. No strings attached. I may have gone against the policy and that's because I wasn't aware. My intentions were genuine... You were not the one I was replying to so I don't u

Re: Calculated Fields

2022-04-21 Thread Ahmedrufai Otuoze
My bad. I bypassed your message completely. Have a great day! On Wed, 13 Apr 2022 at 18:32, Kasper Laudrup wrote: > On 13/04/2022 16.51, Ahmedrufai Otuoze wrote: > > This is not a spam. I just tok a course on that aspect and wanted to > help. > > No strings attached. > > > > I may have gone aga

Sorting on calculated fields

2007-05-24 Thread John M
If I have a model that returns calculated fields, how would I sort a query set on them? Assume the query sets are relatively small (< 100) for now. Is this possible? Thanks john --~--~-~--~~~---~--~~ You received this message because you are subscribed to

Calculated fields and ordering

2020-01-09 Thread Manos Zeakis
lt;...>, 'final_score') list_display = fields <…> Final_score field appears successfully in admin listview, but instead of “normal” fields it does not have an ordering option. I searched for it and I found that calculated fields cannot be sorted because they do

calculated fields with foreign keys

2012-09-20 Thread kloetpatra
all players there will be 2 DB-Queries per player only to get the "goals" property. And I got more "calculated fields" like number of won matches, number of lost matches, etc... There are 364 Match entries and 46 Players. At my overview page I got over 2000 SQL queries which

Re: Sorting on calculated fields

2007-05-24 Thread Tim Chase
> If I have a model that returns calculated fields, how would I sort a > query set on them? > > Assume the query sets are relatively small (< 100) for now. Give this condition (a small set of data) and no need to slice the results on the server based on this order, it can be

Re: Sorting on calculated fields

2007-05-24 Thread Mike Axiak
Axiak On May 24, 8:33 pm, John M <[EMAIL PROTECTED]> wrote: > If I have a model that returns calculated fields, how would I sort a > query set on them? > > Assume the query sets are relatively small (< 100) for now. > > Is th

Re: Sorting on calculated fields

2007-05-25 Thread John M
see how they work, thanks for everyone's response! John On May 24, 7:15 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > If I have a model that returns calculated fields, how would I sort a > > query set on them? > > > Assume the query sets are relatively small (<

Re: Sorting on calculated fields

2007-05-25 Thread Malcolm Tredinnick
On Fri, 2007-05-25 at 09:54 -0700, John M wrote: > Tim, > > great answer, but I'm thinking I might need to build a true queryset > myself. > > I was really hoping to hack the queryset model to allow this to happen > in the django classes. I answered this with a reasonably detailed explanation o