4.8.2 Using Templates in Views

Using the shell is a fantastic way to prototype code. If you made any typos in the last section, you were immediately alerted to them, and any problematic code got sorted out on the fly. However, the shell alone doesn’t build you a website.

Let’s return to our view example from the beginning of the chapter. As a refresher, your /organizer/views.py should currently read as shown in Example 4.76.

Example 4.76: Project Code

organizer/views.py in dd5e4e1a71

 1  from django.http.response import HttpResponse  2  3  from .models import Tag  4  5  6  def homepage(request):  7      tag_list = Tag.objects.all()  8      html_output = "<html>\n "  9      html_output += "<head>\n " 10      html_output ...

Get Django Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.