Re: Model (beginner user) : Sum of the model entries

2017-05-10 Thread Rúben Rodrigues
Anyone could help? terça-feira, 9 de Maio de 2017 às 13:20:56 UTC+1, Rúben Rodrigues escreveu: > > Hi people, > > I'm new in django, so i have simple questions. Sorry for that. > > I want to develop a simple app to make entries in stock. To start i > install the jet dashboard and start an app

Model (beginner user) : Sum of the model entries

2017-05-09 Thread Rúben Rodrigues
Hi people, I'm new in django, so i have simple questions. Sorry for that. I want to develop a simple app to make entries in stock. To start i install the jet dashboard and start an app called polls: https://ibin.co/3LmUv6rGJRXt.png I want to add a entrie and inside i need to have a table

Re: SUM on a model

2008-04-27 Thread dimrub
In addition to the above, you can have a field in your model, that will contain that sum, and update it in your save(). It may not be as beneficial with sum() as it is with some other functions that work on multiple rows. 陈亮 wrote: > Hi there, > I've googled a lot on how to get the sum of a

Re: SUM on a model

2008-04-27 Thread James Bennett
On Sun, Apr 27, 2008 at 8:47 AM, Darryl Ross <[EMAIL PROTECTED]> wrote: > I use: > >total = sum([obj.amount for obj in Model.objects.all()]) As of the merge of qsrf, this will also work: total = sum(Model.objects.values_list('amount', flat=True)) Plus there's the SoC project which

Re: SUM on a model

2008-04-27 Thread Darryl Ross
陈亮 wrote: Hi there, I've googled a lot on how to get the sum of a integer field for all the objects of a model. There are some solutions. But none of them looks like a standard way to do so. Does django have this feature? I use: total = sum([obj.amount for obj in

SUM on a model

2008-04-27 Thread 陈亮
Hi there, I've googled a lot on how to get the sum of a integer field for all the objects of a model. There are some solutions. But none of them looks like a standard way to do so. Does django have this feature? Leon --~--~-~--~~~---~--~~ You received this