5.6 Shortening the Development Process with Django View Shortcuts

We now have a two-function view in /organizer/views.py, which currently reads as shown in Example 5.16.

Example 5.16: Project Code

organizer/views.py in 294dabd8cc

 1  from django.http.response import (  2      Http404, HttpResponse)  3  from django.template import Context, loader  4  5  from .models import Tag  6  7  8  def homepage(request):  9      tag_list = Tag.objects.all() 10      template = loader.get_template( 11          'organizer/tag_list.html') 12      context = Context({'tag_list': tag_list}) 13      output = template.render(context) 14      return HttpResponse(output) 15 16 17  def tag_detail(request, slug): 18      try: 19          tag ...

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.