示例#1
0
 def index(self, request, *args, **kwargs):
     context = {"admin": self}
     context.update(kwargs)
     response = TemplateResponse(request,
                                 "touchtechnology/admin/index.html",
                                 context=context)
     response.current_app = self.name
     return response
示例#2
0
    def render(self, request, templates, context, tz=None, **kwargs):
        logger.debug(
            "{app}.render: {request.path}".format(
                app=self.__class__.__name__, request=request
            )
        )
        context.update({"application": self})
        kwargs.setdefault("context", context)

        response = TemplateResponse(request, templates, **kwargs)
        response.current_app = self.current_app

        if tz is not None:
            with timezone.override(tz):
                response.render()

        if not request.user.is_anonymous:
            patch_cache_control(response, private=True)
        return response