N
N
nik90192020-08-09 15:00:33
Django
nik9019, 2020-08-09 15:00:33

How to stack object property values ​​in db using django?

There is a database model:

class Order(models.Model):
    data = models.DateField()
    time = models.TimeField(null=True)
    status = models.BooleanField(default=False)    
    order_type = models.CharField(max_length=20)
    name = models.CharField(max_length=60, null=True)
    count = models.IntegerField(null=True)
    comment = models.CharField(max_length=60, null=True)


The count property defines a number - a certain amount. How to add the values ​​of the count property of multiple objects and return the sum?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-08-09
@nik9019

https://docs.djangoproject.com/en/3.0/topics/db/ag...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question