43👍
✅
The first way — CategoryTypes.as_view()(self.request)
— is right. The problem is that if your view returns a TemplateResponse
, its render
method isn’t called automatically.
So if you need to access the content of the response, call render()
on it first.
1👍
Or you can directly access just content via result.rendered_content
. Before making this be sure you will set session into your request before passing into a view:
self.request.session = {}
CategoryTypes.as_view()(self.request)
- [Django]-How can I subtract or add 100 years to a datetime field in the database in Django?
- [Django]-Django date to javascript at the template
- [Django]-Best way to get query string from a URL in python?
Source:stackexchange.com