We frequently write little functions that populate the Django context, and sometimes we want that context to be site-wide, and we want every page and every Ajax handler, basically everything that takes a request and spews a response, in our application to have access to that information. It might the user’s authentication, or his authorization, or
(
Read more... )
Comments 2
def context_processor(f):
name = f.__name__
return lambda request: {name: f(request)}
@context_processor
def need_browser_warning(request):
return not adequate_browser(request.META.get('HTTP_USER_AGENT'))
Reply
Reply
Leave a comment