.
What is new in official Codeware Compress Build 6258.11 software version? - New Release. What is expected in the future? Newly-made Codeware Compress Build 6258.11 be downloaded from current page, we also looking forward to unconfirmed 6258.11 release dates. You may download directly, estimated download time by ADSL2+ [~24.5 Mbit/s] is 0:00:26. Just write the reviews of the Codeware Compress. Buy Codeware Compress safely through the one software industry's premier registration commerce providers. System requirements are N/A. No guide or Codeware Compress tutorial available. The following languages are supported by Codeware Compress: English.Q:
Django sum, return total
I have a table with the total amount of each product.
I have to filter it by categories.
How I do it?
I have to use a query like SELECT total, category from my_table where category = 1?
models.py
class Big(models.Model):
size = models.CharField(max_length=100)
order_price = models.DecimalField(max_digits=5, decimal_places=2)
total = models.DecimalField(max_digits=5, decimal_places=2)
def __str__(self):
return str(self.size)
class Products(models.Model):
products_id = models.IntegerField(primary_key=True)
product_name = models.CharField(max_length=100)
sizes = models.ManyToManyField(Big)
views.py
def product(request):
query = Products.objects.all()
query_filter = Products.objects.filter(sizes__category = '1')
query_product = query_filter.order_by('-products_id')
total = Products.objects.all().aggregate(Sum('total'))
# how to filter and show the result?
return render(request, "index.html", { ac619d1d87
Related links:
コメント