2
If you want to access request
object, you can get it from the context
:
@register.inclusion_tag('wiki/includes/render.html', takes_context=True)
def wiki_render(context, article, preview_content=None):
request = context['request']
...
Note that this requires 'django.core.context_processors.request'
to be included in TEMPLATE_CONTEXT_PROCESSORS
, but this is already a prerequisite of django-wiki.
Check the source of login_url
tag of django-wiki for an example.
Source:stackexchange.com