Is this possible to change variable after it’s been catched by url dispatcher and pass it to view changed?
For example:
I’ve got following urlpattern
urlpatterns = patterns('',
(r'^articles/(?P<article_id>\d+)/$', 'article.views.article_view'),
)
I want to change article_id before passing it to article.views.article_view
I need this, as an override. I’ve got article app which can’t be changed, but I must use it. :-/
Use a wrapper view. Map the URL to your own view which then calls
article.views.article_view. You can then change whatever you want within you wrapper view.Example:
In
article_wrapper.py:Update:
If you need to do the same
article_idtranslation for several views, you can probably make the wrapper more generic. Example:and in
article_wrapper.py: