def dispatch(self, request, *args, **kwargs): http_error_strings = { 403: { 'name': _('Forbidden'), 'description': _('Sorry, you have no permission to see this page.'), 'status_code': '403' }, 404: { 'name': _('Not Found'), 'description': _('Sorry, the requested page could not be found.'), 'status_code': '404' }, 500: { 'name': _('Internal Server Error'), 'description': _('Sorry, there was an unknown error. Please contact the event manager.' ), 'status_code': '500' } } context = {} context['http_error'] = http_error_strings[self.status_code] template_manipulation.send(sender=self.__class__, request=request, context=context) response = render_to_response('core/error.html', context_instance=RequestContext( request, context)) response.status_code = self.status_code return response
def extra_context(self): """ Adds extra context variables to set navigation and search filter. Returns a context dictionary. """ context = {} template_manipulation.send( sender=self.__class__, request=self.request, context=context) context['models'] = self.get_indexed_searchmodels() context['get_values'] = self.request.GET.getlist('models') return context
def wrapper(request, *args, **kwargs): output = func(request, *args, **kwargs) if not isinstance(output, dict): return output context = {} template_manipulation.send( sender='utils_template', request=request, context=context) output.update(context) response = render_to_response( template_name, output, context_instance=RequestContext(request)) if 'cookie' in output: response.set_cookie(output['cookie'][0], output['cookie'][1]) return response
def wrapper(request, *args, **kwargs): output = func(request, *args, **kwargs) if not isinstance(output, dict): return output context = {} template_manipulation.send(sender='utils_template', request=request, context=context) output.update(context) response = render_to_response(template_name, output, context_instance=RequestContext(request)) if 'cookie' in output: response.set_cookie(output['cookie'][0], output['cookie'][1]) return response
def dispatch(self, request, *args, **kwargs): http_error_strings = { 403: {'name': _('Forbidden'), 'description': _('Sorry, you have no permission to see this page.'), 'status_code': '403'}, 404: {'name': _('Not Found'), 'description': _('Sorry, the requested page could not be found.'), 'status_code': '404'}, 500: {'name': _('Internal Server Error'), 'description': _('Sorry, there was an unknown error. Please contact the event manager.'), 'status_code': '500'}} context = {} context['http_error'] = http_error_strings[self.status_code] template_manipulation.send(sender=self.__class__, request=request, context=context) response = render_to_response( 'core/error.html', context_instance=RequestContext(request, context)) response.status_code = self.status_code return response
def get_context_data(self, **kwargs): context = super(ExtraContextMixin, self).get_context_data(**kwargs) context.setdefault('extra_javascript', []) template_manipulation.send( sender=self.__class__, request=self.request, context=context) return context
def get_context_data(self, **kwargs): context = super(CreateView, self).get_context_data(**kwargs) template_manipulation.send(sender=self.__class__, request=self.request, context=context) return context