Opened 18 years ago

Closed 18 years ago

#3402 closed (wontfix)

Enable the 'stem' part of the matched URL to be passed to the view

Reported by: medhat Owned by: Adrian Holovaty
Component: Core (Other) Version: dev
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently, when django is doing url matching, and it reaches a point where the urls.py file is including another urls.py, it will discard the part that was mathced so far, and then begin matching inside the included urls.py. This patch will enable passing that discarded part (here called stem) to the view that will be eventually called.

This will be useful in the case where one view is called by many url patterns from many urls.py files. It will enable the view to know where it was called from.

This patch is fully backwards compatible.

Attachments (1)

django_stem.patch (11.5 KB ) - added by medhat 18 years ago.
patch with documentation and tests

Download all attachments as: .zip

Change History (8)

by medhat, 18 years ago

Attachment: django_stem.patch added

patch with documentation and tests

comment:1 by Gary Wilson <gary.wilson@…>, 18 years ago

Triage Stage: UnreviewedDesign decision needed

comment:2 by Matt, 18 years ago

You can already do this. For example:

(r'^(?P<section>news)/', include('myproject.apps.news.urls')),

Each view mapped to a URL in myproject.apps.news.urls will receive a variable section containing the string 'news'.

In my humble opinion, I would suggest closing this ticket.

comment:3 by Adrian Holovaty, 18 years ago

Resolution: worksforme
Status: newclosed

Closing as worksforme for the reason Matt pointed out.

comment:5 by anonymous, 18 years ago

Resolution: worksforme
Status: closedreopened

comment:6 by medhat, 18 years ago

I reopened this, hoping to entice more discussion on the merits of this change. Some of the discussion is already in the google groups discussion mentioned in my comment of 1/31.

comment:7 by Adrian Holovaty, 18 years ago

Resolution: wontfix
Status: reopenedclosed

Remarking as wontfix, as it was before.

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