The model:
class Boat(models.Model):
name = models.CharField(max_length=100)
quantity = models.DecimalField(max_digits=8, decimal_places=2)
fish_type = models.CharField(max_length=50, choices=FISH_TYPE)
def __str__(self):
return self.name
See retrieving specific objects and field lookups
What "total quantity’ are you looking for?
I want to filter by name and sum the quantity of those objects.
Ok, so then you also want to see the Aggregation docs.
I read this docs, and I am trying to make a view that return the quantity sum and I can’t figure it out.
any thought on how can I implement it???
What are some of the queries you’ve tried so far?
The examples in the Cheat Sheet section should give you some ideas,