Code

Opened 23 months ago

Closed 22 months ago

Last modified 22 months ago

#18915 closed Cleanup/optimization (fixed)

Unused import in resulting polls/urls.py module

Reported by: intruder0815@… Owned by: nickmartini
Component: Documentation Version: master
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.

Attachments (0)

Change History (8)

comment:1 Changed 22 months ago by spulec

  • Easy pickings set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 22 months ago by nickmartini

  • Owner changed from nobody to nickmartini

comment:3 Changed 22 months ago by dloewenherz

comment:4 Changed 22 months ago by Dan Loewenherz <dloewenherz@…>

  • Resolution set to fixed
  • Status changed from new to closed

In [07b3d39d101ff0465a5084266745b3db143552e9]:

remove unused import in decoupling URLs tutorial, closes #18915

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

comment:5 Changed 22 months ago by Alex Gaynor <alex.gaynor@…>

In [4321ee25c5c490b94fa0c6e2da5e0b3df215ff81]:

Merge pull request #336 from dlo/tickets/18915

remove unused import in decoupling URLs tutorial, closes #18915

comment:6 Changed 22 months ago by nickmartini

  • 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 Changed 22 months ago by Tim Graham <timograham@…>

In [499e71eb2e9e565818c9244fdbea13eca88a7ee8]:

Merge pull request #341 from nmartini/master

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

comment:8 Changed 22 months ago by Tim Graham <timograham@…>

In [1d235b39142d830a221bda4c55dc3357446deb57]:

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

Remove unused imports in tutorial 4. refs #18915

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.