Пример #1
0
 def render_to_response(self, context, **response_kwargs):
     default_context = {
         'title': config.SITE_NAME,
         'meta_description': config.META_DESCRIPTION,
     }
     new_context = {**default_context,  **context}
     
     return TemplateView.render_to_response(self, new_context, **response_kwargs)
Пример #2
0
 def render_to_response(self, context, **response_kwargs):
     if context.get('params'):  # for django 1.4 compatibility
         context = context['params']
     if not context.get('router'):
         raise ValueError('router param missing')
     maker = ModelMaker(context['router'], context.get('url_prefix'))
     context['models'] = SafeString(maker.toJS())
     return TemplateView.render_to_response(self, context, mimetype='text/javascript')
Пример #3
0
 def render_to_response(self, context, **response_kwargs):
     #django 1.4 compatibility
     if context.get('params'):
         context = context['params']
     if (not context.get('router')):
         raise ValueError('router param missing')
     maker = ModelMaker(context['router'], context.get('url_prefix'))
     context['models'] = SafeString(maker.toJS())
     return TemplateView.render_to_response(self,
                                            context,
                                            content_type='text/javascript')
Пример #4
0
    def render_to_response(self, context, **response_kwargs):
        """A custom render_to_response that does some additional work."""

        context = validate(['start', 'end', 'interval'], context)

        # Hack for a validation error.
        if isinstance(context, HttpResponseBadRequest):
            return context

        return TemplateView.render_to_response(self,
                                               {'start_ts': context['start'],
                                                'end_ts': context['end'],
                                                'interval': context['interval']
                                                })
Пример #5
0
    def render_to_response(self, context, **response_kwargs):
        """A custom render_to_response that does some additional work."""

        context = validate(['start', 'end', 'interval'], context)

        # Hack for a validation error.
        if isinstance(context, HttpResponseBadRequest):
            return context

        return TemplateView.render_to_response(self,
                                               {'start_ts': context['start'],
                                                'end_ts': context['end'],
                                                'interval': context['interval']
                                                })
Пример #6
0
 def render_to_response(self, context, **response_kwargs):
     """Render response with status code 401."""
     response_kwargs.setdefault('status', 403)
     return TemplateView.render_to_response(self, context,
                                            **response_kwargs)
Пример #7
0
 def render_to_response(self, context):
     context = {}
     return TemplateView.render_to_response(self,context)
Пример #8
0
    def render_to_response(self, context):

        context["FB_APP_ID"] = FACEBOOK_CONFIG["id"]
        context["HOST"] = HOST
        return TemplateView.render_to_response(self, context)
Пример #9
0
 def render_to_response(self, context):
     csv_type = self.request.GET.get('csv', None)
     if csv_type in self.csv_types:
         return self.csv_types[csv_type](context['words'])
     return TemplateView.render_to_response(self, context)
Пример #10
0
    def inner(obj: TemplateView, request, *args, **kwargs):
        context = obj.get_context_data(**kwargs)

        context = method(obj, request, context, *args, **kwargs)
        return obj.render_to_response(context)
Пример #11
0
 def render_to_response(self, context):
     return TemplateView.render_to_response(self, context)
Пример #12
0
 def render_to_response(self, context):
     
     if not self.request.user.is_authenticated():
         return redirect('accounts/register')
     
     return TemplateView.render_to_response(self, context)
Пример #13
0
    def render_to_response(self, context):

        if not self.request.user.is_authenticated():
            return redirect('accounts/register')

        return TemplateView.render_to_response(self, context)