Count Objects

Report a typo

We have a model Drink with fields brand, taste:

class Drink(models.Model):
    brand = models.CharField(max_length=32)
    taste = models.CharField(max_length=32)

We pass a QuerySet with drinks to a template in context dictionary: {'drinks': ...}.

Render the number of drinks passed in the QuerySet.

Write a program in Python 3
template = """
<html>
<div>
The assortment is {{ }} drinks
</div>
</html>
"""
___

Create a free account to access the full topic