Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#18915 closed Cleanup/optimization (fixed)

Unused import in resulting polls/urls.py module

Reported by: intruder0815@… Owned by: nickmartini
Component: Documentation Version: dev
Severity: Normal Keywords: cleanup unused import
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

There's an unused import in the resulting polls.urls module in section https://docs.djangoproject.com/en/dev/intro/tutorial03/#decoupling-the-urlconfs .

Now that we've decoupled that, we need to decouple the polls.urls URLconf by removing the leading "polls/" from each line, and removing the lines registering the admin site. Your polls/urls.py file should now look like this:

from django.conf.urls import patterns, include, url

urlpatterns = patterns('polls.views',
    url(r'^$', 'index'),
    url(r'^(?P<poll_id>\d+)/$', 'detail'),
    url(r'^(?P<poll_id>\d+)/results/$', 'results'),
    url(r'^(?P<poll_id>\d+)/vote/$', 'vote'),
)

The imported 'include' will never be used.

Change History (8)

comment:1 by Steve Pulec, 12 years ago

Easy pickings: set
Triage Stage: UnreviewedAccepted

comment:2 by nickmartini, 12 years ago

Owner: changed from nobody to nickmartini

comment:3 by Dan Loewenherz, 12 years ago

comment:4 by Dan Loewenherz <dloewenherz@…>, 12 years ago

Resolution: fixed
Status: newclosed

In [07b3d39d101ff0465a5084266745b3db143552e9]:

remove unused import in decoupling URLs tutorial, closes #18915

The include function isn't used in polls/urls.py.

comment:5 by Alex Gaynor <alex.gaynor@…>, 12 years ago

In [4321ee25c5c490b94fa0c6e2da5e0b3df215ff81]:

Merge pull request #336 from dlo/tickets/18915

remove unused import in decoupling URLs tutorial, closes #18915

comment:6 by nickmartini, 12 years ago

Has patch: set

Oh, I had assigned this to myself and did a pull request: https://github.com/django/django/pull/341

I see Alex submitted a patch to remove the include import, but I also updated the associated docs text in my patch so hopefully that's of use.

comment:7 by Tim Graham <timograham@…>, 12 years ago

In [499e71eb2e9e565818c9244fdbea13eca88a7ee8]:

Merge pull request #341 from nmartini/master

Updated text in tutorial 3 regarding removing unused import; refs #18915

comment:8 by Tim Graham <timograham@…>, 12 years ago

In [1d235b39142d830a221bda4c55dc3357446deb57]:

Merge pull request #351 from 1ntrud3r/patch-1

Remove unused imports in tutorial 4. refs #18915

Note: See TracTickets for help on using tickets.
Back to Top