Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#14627 closed (fixed)

Add example for URLconfs for how to concatenate calls to patterns() when composing urlpatterns to allow for URLs not associated with polls.views

Reported by: filmer Owned by: nobody
Component: Documentation Version: dev
Severity: Keywords: URLconfs concatenate
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This was my question and answer that I asked in the IRC chatroom #Django on freenode. I thought it might be worth showing an example of this. Maybe it is beyond the scope of this document - maybe not... for sure it was a question on my mind when I read this tutorial.

Chatroom copy/paste:
[1:52pm] filmer: I have a newb question about urls - I'm following http://docs.djangoproject.com/en/dev/intro/tutorial03/#simplifying-the-urlconfs And under "Simplifying the URLconfs it shows how you can set 'polls.views' at the beginning of patterns variable. My question is - what if later on down in patterns you want to list something else that has nothing to do with polls.views - for instance admin or CSS or anything else that you might have going on - how do you snip off 'polls.views'?

... [cut out chat room chatter here]

[1:54pm] j00bar: filmer: you either don't put anything at the beginning of patterns or you concatenate multiple calls to patterns() together when composing urlpatterns
[1:54pm] filmer: j00bar: Thank you very much
[1:55pm] • filmer owes j00bar a beer

... [cut out chat room chatter here]

[1:56pm] filmer: maybe they should show an example of that in the tutorial - it might prove helpful in the future for other dumb people like me

Change History (3)

comment:1 by filmer, 13 years ago

Version: 1.2SVN

comment:2 by Gabriel Hurley, 13 years ago

Resolution: fixed
Status: newclosed

(In [14472]) Fixed #14627 -- Made Tutorial 3 more explicit regarding the transformations the URLconf undergoes in the final two sections, and gave an example of concatenating two patterns() in the process. Thanks to filmer for the report.

comment:3 by Gabriel Hurley, 13 years ago

(In [14473]) [1.2.X] Fixed #14627 -- Made Tutorial 3 more explicit regarding the transformations the URLconf undergoes in the final two sections, and gave an example of concatenating two patterns() in the process. Thanks to filmer for the report.

Backport of [14472] from trunk.

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