Commit 26a92619 authored by Collin Anderson's avatar Collin Anderson
Browse files

Fixed #24124 -- Changed context_processors in the default settings.py

parent bbbed99f
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -61,10 +61,7 @@ TEMPLATES = [
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.i18n',
                'django.template.context_processors.tz',
                'django.template.context_processors.media',
                'django.template.context_processors.static',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
+1 −4
Original line number Diff line number Diff line
@@ -501,10 +501,7 @@ Open your settings file (:file:`mysite/settings.py`, remember) and add a
            'OPTIONS': {
                'context_processors': [
                    'django.template.context_processors.debug',
                    'django.template.context_processors.i18n',
                    'django.template.context_processors.tz',
                    'django.template.context_processors.media',
                    'django.template.context_processors.static',
                    'django.template.context_processors.request',
                    'django.contrib.auth.context_processors.auth',
                    'django.contrib.messages.context_processors.messages',
                ],
+2 −3
Original line number Diff line number Diff line
@@ -1873,10 +1873,9 @@ for :doc:`managing stored files </topics/files>`. It must end in a slash if set
to a non-empty value. You will need to :ref:`configure these files to be served
<serving-uploaded-files-in-development>` in both development and production.

In order to use ``{{ MEDIA_URL }}`` in your templates, you must have
If you want to use ``{{ MEDIA_URL }}`` in your templates, add
``'django.template.context_processors.media'`` in the ``'context_processors'``
option of :setting:`TEMPLATES`. It's there by default, but be sure to include
it if you override that setting and want this behavior.
option of :setting:`TEMPLATES`.

Example: ``"http://media.example.com/"``

+4 −8
Original line number Diff line number Diff line
@@ -554,12 +554,9 @@ settings file, the default template engine contains the following context
processors::

    [
        'django.contrib.auth.context_processors.auth',
        'django.template.context_processors.debug',
        'django.template.context_processors.i18n',
        'django.template.context_processors.media',
        'django.template.context_processors.static',
        'django.template.context_processors.tz',
        'django.template.context_processors.request',
        'django.contrib.auth.context_processors.auth',
        'django.contrib.messages.context_processors.messages',
    ]

@@ -625,7 +622,7 @@ Built-in template context processors
Context processors
------------------

Here's what each of the default processors does:
Here's what each of the built-in processors does:

django.contrib.auth.context_processors.auth
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -695,8 +692,7 @@ django.template.context_processors.request
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If this processor is enabled, every ``RequestContext`` will contain a variable
``request``, which is the current :class:`~django.http.HttpRequest`. Note that
this processor is not enabled by default; you'll have to activate it.
``request``, which is the current :class:`~django.http.HttpRequest`.

django.contrib.messages.context_processors.messages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+7 −7
Original line number Diff line number Diff line
@@ -208,6 +208,7 @@ Include a form in ``template.html`` that will ``POST`` to this view:
.. code-block:: html+django

    {% load tz %}
    {% get_current_timezone as TIME_ZONE %}
    <form action="{% url 'set_timezone' %}" method="POST">
        {% csrf_token %}
        <label for="timezone">Time zone:</label>
@@ -311,16 +312,15 @@ time zone is unset, the default time zone applies.
get_current_timezone
~~~~~~~~~~~~~~~~~~~~

When the ``django.template.context_processors.tz`` context processor is
enabled -- by default, it is -- each :class:`~django.template.RequestContext`
contains a ``TIME_ZONE`` variable that provides the name of the current time
zone.

If you don't use a :class:`~django.template.RequestContext`, you can obtain
this value with the ``get_current_timezone`` tag::
You can get the name of the current time zone using the
``get_current_timezone`` tag::

    {% get_current_timezone as TIME_ZONE %}

If you enable the ``django.template.context_processors.tz`` context processor,
each :class:`~django.template.RequestContext` will contain a ``TIME_ZONE``
variable with the value of ``get_current_timezone()``.

Template filters
----------------

Loading