mirror of
				https://github.com/django/django.git
				synced 2025-10-26 07:06:08 +00:00 
			
		
		
		
	Fixed #1271 -- Added a 'request' template context processor, which is not activated by default.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2133 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		| @@ -110,6 +110,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( | |||||||
|     'django.core.context_processors.auth', |     'django.core.context_processors.auth', | ||||||
|     'django.core.context_processors.debug', |     'django.core.context_processors.debug', | ||||||
|     'django.core.context_processors.i18n', |     'django.core.context_processors.i18n', | ||||||
|  | #    'django.core.context_processors.request', | ||||||
| ) | ) | ||||||
|  |  | ||||||
| # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a | # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a | ||||||
|   | |||||||
| @@ -38,6 +38,9 @@ def i18n(request): | |||||||
|         context_extras['LANGUAGE_CODE'] = LANGUAGE_CODE |         context_extras['LANGUAGE_CODE'] = LANGUAGE_CODE | ||||||
|     return context_extras |     return context_extras | ||||||
|  |  | ||||||
|  | def request(request): | ||||||
|  |     return {'request': request} | ||||||
|  |  | ||||||
| # PermWrapper and PermLookupDict proxy the permissions system into objects that | # PermWrapper and PermLookupDict proxy the permissions system into objects that | ||||||
| # the template system can understand. | # the template system can understand. | ||||||
|  |  | ||||||
|   | |||||||
| @@ -329,6 +329,16 @@ See the `internationalization docs`_ for more. | |||||||
| .. _LANGUAGE_CODE setting: http://www.djangoproject.com/documentation/settings/#language-code | .. _LANGUAGE_CODE setting: http://www.djangoproject.com/documentation/settings/#language-code | ||||||
| .. _internationalization docs: http://www.djangoproject.com/documentation/i18n/ | .. _internationalization docs: http://www.djangoproject.com/documentation/i18n/ | ||||||
|  |  | ||||||
|  | django.core.context_processors.request | ||||||
|  | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|  |  | ||||||
|  | **New in Django development version** | ||||||
|  |  | ||||||
|  | If ``TEMPLATE_CONTEXT_PROCESSORS`` contains this processor, every | ||||||
|  | ``DjangoContext`` will contain a variable ``request``, which is the current | ||||||
|  | `HttpRequest object`_. Note that this processor is not enabled by default; | ||||||
|  | you'll have to activate it. | ||||||
|  |  | ||||||
| Loading templates | Loading templates | ||||||
| ----------------- | ----------------- | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user