Opened 10 years ago
Last modified 10 years ago
#24430 closed New feature
wildcard matching and reversing of URLs — at Initial Version
Reported by: | Anshuman Aggarwal | Owned by: | nobody |
---|---|---|---|
Component: | Core (URLs) | Version: | 1.7 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Example:
urlpatterns += patterns(,
(r'\w+/', include(admin.site.urls),),
)
All links generated by the admin site with this url show a 'x'
for example
/x/<app_name>/<model_name>/
instead of the result of the matching wild card 'ABC' from ABC/<app_name>/<model_name>
the problem is that reverse can not know what to put in the wild card without having the path or the request as context.
Solution: add an optional parameter to reverse which is the request and the reverse can happen with the context of the request which is found acceptable in case the request parameter is not none.