#30705: Django template permissions not working when used inside the template of an inclusion tag -------------------------------------+------------------------------------- Reporter: erev0s | Owner: nobody Type: Bug | Status: closed Component: Template system | Version: 2.2 Severity: Normal | Resolution: invalid Keywords: permissions, | Triage Stage: inclusion tag | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by Carlton Gibson):
* status: new => closed * resolution: => invalid Comment: The block is not rendered because `perms` is not present in the context of your inclusion tag, so the conditional correctly evaluates to `False`. Take a look at the [https://docs.djangoproject.com/en/2.2/howto/custom- template-tags/#inclusion-tags Inclusion tags] docs. You'll need to use the `takes_context` kwarg and pass a reference to `perms` as per the examples there. I recommend investigating [https://django-debug- toolbar.readthedocs.io/en/latest/index.html Django Debug Toolbar] to see exactly what templates are rendered, with exactly what contexts. Please see TicketClosingReasons/UseSupportChannels for appropriate support channels. -- Ticket URL: <https://code.djangoproject.com/ticket/30705#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 unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/064.185e236b23c63ca4a305356b9512866b%40djangoproject.com.