#19889: Tutorial03 makes you refactor code that you cannot run -------------------------------+-------------------- Reporter: jpic | Owner: nobody Type: Uncategorized | Status: new Component: Documentation | Version: master Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+-------------------- 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 ? -- Ticket URL: <https://code.djangoproject.com/ticket/19889> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.