title: Python:"name 'cd' is not defined"
body: <p>well, this is the code:</p>
  
  <pre><code>def post_search(request):
      global cd,results,total_results
      form = SearchForm()
      if 'query' in request.GET:
          form = SearchForm(request.GET)
          if form.is_valid():
              cd = form.cleaned_data
              results = SearchQuerySet().models(Post).filter(content=cd['query']).load_all()
              # count total results
              total_results = results.count()
      return render(request, 'blog/post/search.html', {'form': form,
                                                       'cd': cd,
                                                       'results': results,
                                                       'total_results': total_results})
  </code></pre>
  
  <p>find the error blow:
  <code>name 'cd' is not defined</code></p>
  
  <p>I defined 'cd' , how it comes out this error ？</p>