def render_to_response(self, context): format = self.request.GET.get('format', 'html') if format.lower() == 'json': return JSONResponseMixin.render_to_response(self, context) elif format.lower() == 'xml': return XMLResponseMixin.render_to_response(self, context) elif format.lower() == 'html': return TemplateView.render_to_response(self, context) else: return HttpResponseBadRequest()
def render_to_response(self, context): # If it's an ajax request or if it has a 'format=json' GET argument # then return as json otherwise spit out the template. page_format = self.request.REQUEST.get('format', 'html') if self.return_json: return JSONResponseMixin.render_to_response(self, context) else: if 'popup' in self.request.REQUEST: context['base_template'] = "popup_base.html" else: context['base_template'] = "base.html" return TemplateView.render_to_response(self, context)
def render_to_response(self, context): if self.request.is_ajax(): return JSONResponseMixin.render_to_response(self, context) return TemplateView.render_to_response(self, context)
def render_to_response(self, context, **response_kwargs): if 'user_profile' in context: return TemplateView.render_to_response(self, context, **response_kwargs) else: raise Http404
def render_to_response(self, context): if self.request.is_ajax() or self.template_name is None: return JSONResponseMixin.render_to_response(self, context) else: return TemplateView.render_to_response(self, context)
def render_to_response(self, context): """ Returns a JSON response containing 'context' as payload """ if self.is_ajax() or self.accepts_json(): return BaseDatatableView.render_to_response(self, context) return TemplateView.render_to_response(self, context)
def render_to_response(self, context): if self.request.is_ajax(): return JSONResponseMixin.render_to_response(self, context) return TemplateView.render_to_response(self, context)