mirror of
https://github.com/django/django.git
synced 2025-10-25 14:46:09 +00:00
MERGED MAGIC-REMOVAL BRANCH TO TRUNK. This change is highly backwards-incompatible. Please read http://code.djangoproject.com/wiki/RemovingTheMagic for upgrade instructions.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2809 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -4,10 +4,10 @@ template context. Each function takes the request object as its only parameter
|
||||
and returns a dictionary to add to the context.
|
||||
|
||||
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
|
||||
DjangoContext.
|
||||
RequestContext.
|
||||
"""
|
||||
|
||||
from django.conf.settings import DEBUG, INTERNAL_IPS, LANGUAGES, LANGUAGE_CODE
|
||||
from django.conf import settings
|
||||
|
||||
def auth(request):
|
||||
"""
|
||||
@@ -23,19 +23,19 @@ def auth(request):
|
||||
def debug(request):
|
||||
"Returns context variables helpful for debugging."
|
||||
context_extras = {}
|
||||
if DEBUG and request.META.get('REMOTE_ADDR') in INTERNAL_IPS:
|
||||
if settings.DEBUG and request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS:
|
||||
context_extras['debug'] = True
|
||||
from django.core import db
|
||||
context_extras['sql_queries'] = db.db.queries
|
||||
from django.db import connection
|
||||
context_extras['sql_queries'] = connection.queries
|
||||
return context_extras
|
||||
|
||||
def i18n(request):
|
||||
context_extras = {}
|
||||
context_extras['LANGUAGES'] = LANGUAGES
|
||||
context_extras['LANGUAGES'] = settings.LANGUAGES
|
||||
if hasattr(request, 'LANGUAGE_CODE'):
|
||||
context_extras['LANGUAGE_CODE'] = request.LANGUAGE_CODE
|
||||
else:
|
||||
context_extras['LANGUAGE_CODE'] = LANGUAGE_CODE
|
||||
context_extras['LANGUAGE_CODE'] = settings.LANGUAGE_CODE
|
||||
return context_extras
|
||||
|
||||
def request(request):
|
||||
|
||||
Reference in New Issue
Block a user