Skip to content

Commit

Permalink
Merge branch 'update_readme' of https://github.com/prokaktus/django-m…
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmuellegger committed Jul 19, 2016
2 parents 98caf7d + d517c6f commit 362fae1
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ is enabled and working.
``MIDDLEWARE_CLASSES`` setting. Make sure it's listed *after*
``MobileDetectionMiddleware`` and also after ``SessionMiddleware``.
5. Add ``django_mobile.loader.Loader`` as first item to your
``TEMPLATE_LOADERS`` list in ``settings.py``.
``loaders`` list for ``TEMPLATES`` setting in ``settings.py``.
6. Add ``django_mobile.context_processors.flavour`` to your
``TEMPLATE_CONTEXT_PROCESSORS`` setting.
``context_processors`` list for ``TEMPLATES`` setting. You can read more about ``loaders`` and ``context_processors`` in `Django docs`_.

*Note:* If you are using Django 1.7 or older, you need to change step 5 and 6 slightly. Use the ``TEMPLATE_LOADERS`` and ``TEMPLATE_CONTEXT_PROCESSORS`` settings instead of ``TEMPLATES``.

Now you should be able to use **django-mobile** in its glory. Read below of how
things work and which settings can be tweaked to modify **django-mobile**'s
Expand Down Expand Up @@ -325,19 +327,27 @@ account. To use it, put the following bit into your ``settings.py`` file:

.. code-block:: python
TEMPLATE_LOADERS = (
('django_mobile.loader.CachedLoader', (
'django_mobile.loader.Loader',
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)),
)
TEMPLATES = [
{
...
'OPTIONS': {
...
'loaders': ('django_mobile.loader.CachedLoader', (
'django_mobile.loader.Loader',
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)),
}
}
]
.. _cached template loader:
https://docs.djangoproject.com/en/dev/ref/templates/api/#django.template.loaders.cached.Loader

.. _middleware.py:
examples/middleware.py
.. _Django docs:
https://docs.djangoproject.com/en/dev/topics/templates/#module-django.template.backends.django

.. |build| image:: https://travis-ci.org/gregmuellegger/django-mobile.svg?branch=master
:alt: Build Status
Expand Down

0 comments on commit 362fae1

Please sign in to comment.