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
- [Answer]-Django Error while inserting null into date field
- [Answer]-How to filter between two databases?
- [Answer]-How to redirect to main page is no pattern is satisfied in django?
Source:stackexchange.com