I am having different URLs configuration. same view is called for two URLs based on **kwargs decision is made what to do? In one of case I need to get result of all related objects which is tagged with given keyword. I found another way to do achieve same using function based view.
On Thursday, November 5, 2015 at 2:44:22 AM UTC+5:30, Daniel Roseman wrote: > > On Wednesday, 4 November 2015 20:51:53 UTC, sonu kumar wrote: >> >> class based views are as below >> >> class TagList(TemplateView): >> >> def get_context_data(self, **kwargs): >> >> ... >> >> qlist = QueList.as_view()(self.request, **kwargs) >> print qlist >> >> ... >> >> >> class QueListView(ListView): >> def get_context_data(self, **kwargs): >> >> ... >> >> >> When QuesList.as_view() is called then it produces The response content must >> be rendered before it can be accessed . on *print qlist* line How to fix >> this error and what's reason behind this? >> >> > > Because a TemplateView returns a TemplateResponse, which needs to be > rendered. See the docs: > https://docs.djangoproject.com/en/1.8/ref/template-response/ > > Can you explain why you are doing this? What's the point of calling one > view from another? There's almost certainly a better way to achieve what > you want. > -- > DR. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/58817820-3048-4245-816e-b96d203f763e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

