Opened 9 years ago

Closed 9 years ago

#5283 closed (invalid)

decoupling example can be extended further

Reported by: stringfellow@… Owned by: nobody
Component: Documentation Version: 0.96
Severity: Keywords: decoupling
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

In Tutorial part 3:

"Now that we’ve decoupled that, we need to decouple the ‘mysite.polls.urls’ urlconf by removing the leading “polls/” from each line:

urlpatterns = patterns('mysite.polls.views',

(r'$', 'index'),
(r'
(?P<poll_id>\d+)/$', 'detail'),
(r'(?P<poll_id>\d+)/results/$', 'results'),
(r'
(?P<poll_id>\d+)/vote/$', 'vote'),

)"

I tested this with:
"urlpatterns = patterns('polls.views',"
and it still works, and assuming this whole directory (polls) can be moved to other websites, it makes sense to drop out 'mysite.' from the pattern; allowing for copy and paste pluggability instead of copy paste and edit a little bit pluggability.

Change History (2)

comment:1 Changed 9 years ago by stringfellow@…

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Similarly, in part 4 -
I dont think it is nescessary to have:
from mysite.polls.models import Poll,Choice
when
from polls.models import Poll,Choice
still works.

comment:2 Changed 9 years ago by James Bennett

Resolution: invalid
Status: newclosed

Closing for same reason as in #5323.

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