[Answer]-Django Templatetag, request username

1👍

request is not a variable in that scope. You will have to get it from the context first

@register.inclusion_tag('studies/student_block.html', takes_context = True)
def student_block(context):
    request = context['request']
    # you can use request what ever you want

https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#inclusion-tags

👤dhana

Leave a comment