How To Override Django View That Has A Namespaced Url Pattern?
I'm using external application called foo which I mostly like, but I need to extend functionality of one specific view called Bar. Normally, I'd just put my extended view in urls.p
Solution 1:
I'm not sure I understand the problem. {% url 'foo:foo' %}
will match the url pattern in the app, and return /foo/path_to_bar/
. That URL will then be matched by your custom URL pattern. The name of the URL pattern of your custom view shouldn't matter.
That won't work if the original app uses a different URL than path_to_bar
. In this case you still don't have to change all the calls to reverse
- just create your own my_foo_urls.py
, duplicate the contents of foo/urls.py
, and include that instead.
Post a Comment for "How To Override Django View That Has A Namespaced Url Pattern?"