[Answer]-AttributeError 'str' object has no attribute 'path'

1👍

Add django.core.context_processors.request to your TEMPLATE_CONTEXT_PROCESSORS in settings.py

Rest of the code looks fine.

0👍

You do not have access to request object in your custom template tag like you do in views. You can find to resolve your issue here – Access request in django custom template tags

Leave a comment