id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 20156 pass context info from PermissionDenied exception to handler403/django.views.defaults.permission_denied jc@… nobody "Being able to raise PermissionDenied in a view and have django.view.defaults.permission_denied render a 403.html template is all well and good. But being able to pass context information via the exception to the template would make it possible to present customized messages to the user – for instance, explaining what action was forbidden and why, and how to rectify the situation. As an example, suppose a view raised a PermissionDenied exception as follows: {{{ raise PermissionDenied('not owner') }}} Then the corresponding 403.html could present a more detailed message like so: {{{ {% with reason=except.args[0] %} {% if reason == 'not owner' %}

You may only edit entries that you own.

{% elif reason == 'not subscribed' %}

You may not edit entries if your subscription has lapsed.

{% endif %} {% endwith %} }}} " New feature closed Core (Other) Normal duplicate Accepted 0 1 0 0 0 0