Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 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: master
Severity: Keywords: URLconfs concatenate
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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

Attachments (0)

Change History (3)

comment:1 Changed 3 years ago by filmer

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Version changed from 1.2 to SVN

comment:2 Changed 3 years ago by gabrielhurley

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

(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 Changed 3 years ago by gabrielhurley

(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.

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.