From 0b29ba80db78f6379de830027a5bba7e28a94155 Mon Sep 17 00:00:00 2001 From: Mikalai Radchuk Date: Wed, 6 Jul 2016 19:01:09 +0300 Subject: [PATCH] Makes notes for settings module more visible (#2826) --- docs/reference/contrib/settings.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/contrib/settings.rst b/docs/reference/contrib/settings.rst index 58913a80ed..676b8fe62d 100644 --- a/docs/reference/contrib/settings.rst +++ b/docs/reference/contrib/settings.rst @@ -118,7 +118,7 @@ Then access the settings through ``{{ settings }}``: {{ settings.app_label.SocialMediaSettings.instagram }} -(Replace ``app_label`` with the label of the app containing your settings model.) +.. note:: Replace ``app_label`` with the label of the app containing your settings model. If you are not in a ``RequestContext``, then context processors will not have run, and the ``settings`` variable will not be availble. To get the ``settings``, use the provided ``{% get_settings %}`` template tag. If a ``request`` is in the template context, but for some reason it is not a ``RequestContext``, just use ``{% get_settings %}``: @@ -168,7 +168,7 @@ Then access the settings through the ``settings()`` template function: {{ settings("app_label.SocialMediaSettings").twitter }} -(Replace ``app_label`` with the label of the app containing your settings model.) +.. note:: Replace ``app_label`` with the label of the app containing your settings model. This will look for a ``request`` variable in the template context, and find the correct site to use from that. If for some reason you do not have a ``request`` available, you can instead use the settings defined for the default site: