Complete the code to import the Django model class.
from django.db import [1]
The models module contains classes to define data structure in Django's MTV pattern.
Complete the code to define a Django view function.
def home(request): return [1]('home.html')
The render function combines a template with data and returns an HTTP response.
Fix the error in the template tag to display a variable.
<p>Hello, [1]!</p>In Django templates, variables are placed inside double curly braces without extra braces.
Fill both blanks to create a model field for a character name with max length 100.
class Person(models.Model): name = models.[1](max_length=[2])
CharField is used for text fields with a max length, here set to 100 characters.
Fill all three blanks to complete a view that queries all Person objects and renders them.
from django.shortcuts import render from .models import Person def list_people(request): people = Person.objects.[1]() return render(request, '[2]', {'[3]': people})
all() fetches all records. The template name is a string. The context key matches the variable passed to the template.