Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clarify docs and add EXCLUDE_APPS default. Fix #22.

  • Loading branch information...
commit 6736d3b0fd7a4c533b3a399694f92e9d0077294a 1 parent f705931
James Socol authored
Showing with 39 additions and 9 deletions.
  1. +16 −4 README.rst
  2. +16 −4 docs/index.rst
  3. +7 −1 jingo/__init__.py
View
20 README.rst
@@ -65,12 +65,24 @@ from the loader::
JINGO_EXCLUDE_APPS = ('debug_toolbar',)
-If a template is in the *app folder*, ``debug_toolbar``, the Jinja loader will
-raise a ``TemplateDoesNotExist`` exception.
-This causes Django to move onto the next loader in ``TEMPLATE_LOADERS``
-to find a template - in this case,
+If a template path begins with ``debug_toolbar``, the Jinja loader will raise a
+``TemplateDoesNotExist`` exception. This causes Django to move onto the next
+loader in ``TEMPLATE_LOADERS`` to find a template - in this case,
``django.template.loaders.filesystem.Loader``.
+.. note::
+ Technically, we're looking at the template path, not the app. Often these are
+ the same, but in some cases, like 'registration' in the default setting--which
+ is an admin template--they are not.
+
+The default is in ``jingo.EXCLUDE_APPS``::
+
+ EXCLUDE_APPS = (
+ 'admin',
+ 'admindocs',
+ 'registration'
+ )
+
If you want to configure the Jinja environment, use ``JINJA_CONFIG`` in
``settings.py``. It can be a dict or a function that returns a dict. ::
View
20 docs/index.rst
@@ -65,12 +65,24 @@ from the loader::
JINGO_EXCLUDE_APPS = ('debug_toolbar',)
-If a template is in the *app folder*, ``debug_toolbar``, the Jinja loader will
-raise a ``TemplateDoesNotExist`` exception.
-This causes Django to move onto the next loader in ``TEMPLATE_LOADERS``
-to find a template - in this case,
+If a template path begins with ``debug_toolbar``, the Jinja loader will raise a
+``TemplateDoesNotExist`` exception. This causes Django to move onto the next
+loader in ``TEMPLATE_LOADERS`` to find a template - in this case,
``django.template.loaders.filesystem.Loader``.
+.. note::
+ Technically, we're looking at the template path, not the app. Often these are
+ the same, but in some cases, like 'registration' in the default setting--which
+ is an admin template--they are not.
+
+The default is in ``jingo.EXCLUDE_APPS``::
+
+ EXCLUDE_APPS = (
+ 'admin',
+ 'admindocs',
+ 'registration'
+ )
+
If you want to configure the Jinja environment, use ``JINJA_CONFIG`` in
``settings.py``. It can be a dict or a function that returns a dict. ::
View
8 jingo/__init__.py
@@ -16,6 +16,12 @@
VERSION = (0, 4)
__version__ = '.'.join(map(str, VERSION))
+EXCLUDE_APPS = (
+ 'admin',
+ 'admindocs',
+ 'registration',
+)
+
log = logging.getLogger('jingo')
_helpers_loaded = False
@@ -204,7 +210,7 @@ class Loader(BaseLoader):
def load_template(self, template_name, template_dirs=None):
if hasattr(template_name, 'rsplit'):
app = template_name.rsplit('/')[0]
- if app in getattr(settings, 'JINGO_EXCLUDE_APPS', []):
+ if app in getattr(settings, 'JINGO_EXCLUDE_APPS', EXCLUDE_APPS):
raise TemplateDoesNotExist(template_name)
try:
template = env.get_template(template_name)
Please sign in to comment.
Something went wrong with that request. Please try again.