﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
19889	Tutorial03 makes you refactor code that you cannot run	James Pic	nobody	"1. [https://docs.djangoproject.com/en/dev/intro/tutorial03/#writing-more-views Writing more views] introduces `polls.views.detail` code that is testable with `runserver`:

{{{
    def detail(request, poll_id):
        return HttpResponse(""You're looking at poll %s."" % poll_id)
}}}

2. Then, [https://docs.djangoproject.com/en/dev/intro/tutorial03/#raising-a-404-error Raising 404 error] introduces a new version of this view:

{{{
def detail(request, poll_id):
    try:
        poll = Poll.objects.get(pk=poll_id)
    except Poll.DoesNotExist:
        raise Http404
    return render(request, 'polls/detail.html', {'poll': poll})
}}}

(Which you cannot test yet because you don't have `polls/detail.html`)

3. Then, this view code changes in [https://docs.djangoproject.com/en/dev/intro/tutorial03/#a-shortcut-get-object-or-404 A shortcut: get_object_or_404].

4. Then, and only then, the tutorial makes you create `polls/details.html` in [https://docs.djangoproject.com/en/dev/intro/tutorial03/#use-the-template-system Use the template system].

I think it's a problem that you code something in step 2., change it in step 3., but are able to test it only after step 4. Shouldn't the app be run-able at every step ?"	Cleanup/optimization	closed	Documentation	dev	Normal	needsinfo		James Pic	Unreviewed	0	0	0	0	1	0
