1 from django.http import HttpResponse
2 from django.shortcuts import render_to_response, get_object_or_404
3 from django.template import RequestContext
5 from taggit.models import Tag
6 from .models import Recipe
10 tag = get_object_or_404(Tag, pk=pk)
11 recipes = Recipe.objects.filter(tags__name__in=[tag.slug])
12 return render_to_response(
13 'cookbook/recipes.html', {'recipes': recipes, 'title': tag.name},
14 RequestContext(request))