Opened 17 years ago
Closed 17 years ago
#5283 closed (invalid)
decoupling example can be extended further
Reported by: | 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: | no | UI/UX: | no |
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 by , 17 years ago
comment:2 by , 17 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Closing for same reason as in #5323.
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.