On Wednesday, 2 November 2011 07:24:39 UTC, rihad wrote:
>
> It says at the end of part 3 of the Django tutorial: 
>
> "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 path root, and the app will still work." 
>
> It's actually not that simple. Simply changing the project-wide 
> URLconf prefix from '^polls/' to '^fun_polls/' will not work, because 
> the code referencing templates still has polls in its path: 
> render_to_response('polls/detail.html', {'poll': p}) 
> or in URLs: 
> <a href="/polls/{{ poll.id }}/">{{ poll.question }}</a>


Your first point is simply not true. Changing the urlconf prefix does not 
in any way affect how you reference the template path. You could prefix the 
polls URLs with 'foobar', but the template path would still be 'polls'.

The second point is made irrelevant by something that's not covered in the 
tutorial, but is mentioned in the actual documentation for URLs: you should 
never hard-code URLs, you should use the `{% url %}` tag in templates or 
the `reverse()` function in views - for precisely this reason.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/rgGqV4vyzw0J.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to