[Fixed]-Django URL: Multiple URL, same views. Then use {% url %} in template

1👍

Since you’re not on 1.9 yet, you need to manually set a namespace hint to the current instance namespace. You can do so by passing the current_app to render() (or directly to your context instance):

render(request, 'template.html', current_app=request.resolver_match.namespace)

In 1.8 you set request.current_app instead of passing the namespace to the context. In 1.9, this is done for you.

You need to set the app_name to 'events' in both includes. Django will look for an application namespace, and only fall back to an instance namespace if no application namespace is found. If you name an instance namespace with no app_name the same as an application namespace, you’ll never be able to reverse it.

👤knbk

Leave a comment