-3👍
✅
Just set attribute to request object in view:
setattr(request, 'view', 'app.views.func')
and check this in template:
{% if request.view == 'app.views.func' %}
do something
{% endif %}
It worked for me.
22👍
Type just in view
{% with request.resolver_match.view_name as view_name %}
...
{{ view_name }}
...
{% endwith %}
- [Django]-Sending a DELETE request to django-rest with angular is interpreted as OPTIONS
- [Django]-Django [Mezzanine CMS] project not deploying to Heroku
1👍
I’m not sure I completely understand the requirement, but take a look at inspect.stack.
inspect.stack()[1][3]
- [Django]-Best practice – Django multisite
- [Django]-Can't get media files in heroku
- [Django]-Django — Generate form based on queryset
- [Django]-Architecture for syncing s3/cloudfront with database
- [Django]-Passing context from child to parent template in Django
Source:stackexchange.com