#18136: Documentation for PermWrapper is wrong --------------------------------------+------------------------------------ Reporter: Fandekasp | Owner: nobody Type: Cleanup/optimization | Status: new Component: Documentation | Version: 1.4 Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 1 Easy pickings: 1 | UI/UX: 0 --------------------------------------+------------------------------------
Comment (by Fandekasp): hmm I don't really know how to improve the doc. Actually, this information is already included in the doc: {{{ .. admonition:: Technicality Technically, these variables are only made available in the template context if you use :class:`~django.template.context.RequestContext` *and* your :setting:`TEMPLATE_CONTEXT_PROCESSORS` setting contains ``"django.contrib.auth.context_processors.auth"``, which is default. For more, see the :ref:`RequestContext docs <subclassing-context- requestcontext>`. }}} I was looking for permissions and started to read from the subtitle without seeing the admonition. Therefore, the doc is correct. My concern was that without reading that admonition, I needed a few time to figure that out: Because I started with a bad {{{ {{ perms.app_label.can_edit_model }} }}} (when it should be {{{ {{ perms.app_label.change_model }} }}}, after reading the {{{PermWrapper}}} code, I though I'd need to call {{{ {{ request.perms.app_label.can_edit_model }} }}}, to add the context_processor etc. What would be nice is to raise a {{{PermissionDoesNotExist}}} or something like that if trying to call {{{ {{ perms.app_label.can_edit_model }} }}} when DEBUG=True. If you agree with that, I'll create a new ticket because it's unrelated to the documentation. -- Ticket URL: <https://code.djangoproject.com/ticket/18136#comment:4> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.