Code

Opened 5 years ago

Closed 5 years ago

#9930 closed (invalid)

An error in part three of Django's tutorial.

Reported by: crazy2k Owned by: nobody
Component: Documentation Version: 1.0
Severity: Keywords: tutorial regular expression strip urls
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The part three of Django's tutorial (http://docs.djangoproject.com/en/dev/intro/tutorial03/#intro-tutorial03) says:
"Then, Django will strip off the matching text ("polls/") and send the remaining text -- "34/" -- to the 'mysite.polls.urls' URLconf for further processing."

Shouldn't it say something like "Django will strip off the first substring, from left to right, that matches"? Because I think the whole "/polls/34/" would match, and just the first part is removed..

Attachments (0)

Change History (2)

comment:1 Changed 5 years ago by crazy2k

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Also, it says
"The idea behind include() and URLconf decoupling is to make it easy to plug-and-play URLs. Now that polls are in their own URLconf, they can be placed under "/polls/", or under "/fun_polls/", or under "/content/polls/", or any other URL root, and the app will still work."

That's not entirely true, is it? The first argument to patterns() in "/[polls|fun_polls|etc]/urls.py" and the path given to "include()" in the project's main urls.py would also have to be changed if the URLconf file for the app is moved.

comment:2 Changed 5 years ago by lukeplant

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

First point: the tutorial is correct in the way it describes how include() works, I can't think of any clearer way to explain it, so I'll just presume you have misunderstood.

Second: It seems when you talk about 'moving' apps you are referring to changing the 'Python path' of the app (where you import it from). If you change the module hierarchy of an app, it is inevitable that you will have to change anything that refers to it (whether using import statements or dotted paths). But the tutorial is referring to changing where it is 'hosted' in the URL hierarchy, so the statement made about URLconf decoupling is "entirely true".

Thanks.

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.