Template With an Instance of a Model

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)

An instance of the model is passed to a template in context dictionary: {'drink': ...}.

Render the brand of a drink in the "h2" element and taste in the "div" element.

Write a program in Python 3
template = """
<html>
<h2> </h2>
<div> </div>
</html>
"""
___

Create a free account to access the full topic