Ticket #1666: render_to_response_in_docs.patch

File render_to_response_in_docs.patch, 3.7 KB (added by Chris Beaven, 18 years ago)
  • docs/forms.txt

     
    110110        # Create a FormWrapper object that the template can use. Ignore
    111111        # the last two arguments to FormWrapper for now.
    112112        form = forms.FormWrapper(places.AddManipulator(), {}, {})
    113         return render_to_response('places/naive_create_form', {'form': form})
     113        return render_to_response('places/naive_create_form.html', {'form': form})
    114114
    115115(This view, as well as all the following ones, has the same imports as in the
    116116first example above.)
     
    161161        # Check for validation errors
    162162        errors = manipulator.get_validation_errors(new_data)
    163163        if errors:
    164             return render_to_response('places/errors', {'errors': errors})
     164            return render_to_response('places/errors.html', {'errors': errors})
    165165        else:
    166166            manipulator.do_html2python(request.POST)
    167167            new_place = manipulator.save(request.POST)
     
    233233
    234234        # Create the FormWrapper, template, context, response.
    235235        form = forms.FormWrapper(manipulator, new_data, errors)
    236         return render_to_response('places/create_form', {'form': form})
     236        return render_to_response('places/create_form.html', {'form': form})
    237237
    238238and here's the ``create_form`` template::
    239239
     
    322322            new_data = place.__dict__
    323323
    324324        form = forms.FormWrapper(manipulator, new_data, errors)
    325         return render_to_response('places/edit_form', {'form': form, 'place': place})
     325        return render_to_response('places/edit_form.html', {'form': form, 'place': place})
    326326
    327327The only real differences are:
    328328
     
    401401        else:
    402402            errors = new_data = {}
    403403        form = forms.FormWrapper(manipulator, new_data, errors)
    404         return render_to_response('contact_form', {'form': form})
     404        return render_to_response('contact_form.html', {'form': form})
    405405
    406406Validators
    407407==========
  • docs/overview.txt

     
    198198    def article_detail(request, year, month, article_id):
    199199        # Use the Django API to find an object matching the URL criteria.
    200200        a = get_object_or_404(articles, pub_date__year=year, pub_date__month=month, pk=article_id)
    201         return render_to_response('news/article_detail', {'article': a})
     201        return render_to_response('news/article_detail.html', {'article': a})
    202202
    203203This example uses Django's template system, which has several key features.
    204204
  • docs/sessions.txt

     
    141141            else:
    142142                return HttpResponse("Please enable cookies and try again.")
    143143        request.session.set_test_cookie()
    144         return render_to_response('foo/login_form')
     144        return render_to_response('foo/login_form.html')
    145145
    146146Using sessions out of views
    147147===========================
  • docs/tutorial04.txt

     
    101101
    102102    def results(request, poll_id):
    103103        p = get_object_or_404(Poll, pk=poll_id)
    104         return render_to_response('polls/results', {'poll': p})
     104        return render_to_response('polls/results.html', {'poll': p})
    105105
    106106This is almost exactly the same as the ``detail()`` view from `Tutorial 3`_.
    107107The only difference is the template name. We'll fix this redundancy later.
Back to Top