This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Manages to load templates according to the type of device to a specific directory prefix.

These loaders work with the django-mobi app. Please read the documentation for more information: https://pypi.python.org/pypi/django-mobi

Install

It is strongly recommanded to install this theme from GIT with PIP onto you project virtualenv.

From PyPi

pip install django-adaptive

From Github

-e git+https://github.com/RevSquare/django-adaptive#egg=django-adaptive

Setup

Before starting, make sure you have correctly setup django-mobi: https://pypi.python.org/pypi/django-mobi

Django adaptive basicaly overwrites django default filesystem and app_directories loaders. You can pick the overwritten loader you want to use separately and use them concurently with the former django loaders.

The first step is to add the app in your installed apps list in settings.py

INSTALLED_APPS = (
    ...
    'django_adaptive'
    ...
)

Then you will need to declare the loaders you want to add in your settings.py file

TEMPLATE_LOADERS = (
    'django-adaptive.filesystem.Loader',
    'django-adaptive.app_directories.Loader',
    #'django.template.loaders.filesystem.Loader',
    #'django.template.loaders.app_directories.Loader',
)

It’s also possible to use cached loader. It works with django 1.7.x

TEMPLATE_LOADERS = (
('django_adaptive.cached.Loader', (
    'django_adaptive.filesystem.Loader',
    'django_adaptive.app_directories.Loader',
    )),
)

Final step is to add ThreadLocal Middleware

MIDDLEWARE_CLASSES = (
    ...
    'mobi.middleware.MobileDetectionMiddleware',
    'django_adaptive.middleware.ThreadLocals',
    ...
)

Declaring your device prefixes

At this stage nothing will be done. You need to specify the directories for each device categories in your settings.py.

The settings constants are:

  • ADAPTIVE_TEMPLATE_DIRECTORIES_DESKTOP
  • ADAPTIVE_TEMPLATE_DIRECTORIES_TABLET
  • ADAPTIVE_TEMPLATE_DIRECTORIES_MOBILE

Usage exemple:

import os

DEBUG = True
TEMPLATE_DEBUG = DEBUG

PROJECT_PATH = os.path.join(os.path.dirname(__file__), '..')

TEMPLATE_DIRS = (
    os.path.join(PROJECT_PATH, 'templates')
)

ADAPTIVE_TEMPLATE_DIRECTORIES_MOBILE = 'mobile'

This code will install the templates for mobile in the templates/mobile directory. And the rest of the files in templates (by default no prefix is added).

In case you would need to combine devices type in a similar directory, you just need to point them to it. For exemple:

ADAPTIVE_TEMPLATE_DIRECTORIES_DESKTOP = 'desktop'
ADAPTIVE_TEMPLATE_DIRECTORIES_TABLET = 'mobile'
ADAPTIVE_TEMPLATE_DIRECTORIES_MOBILE = 'mobile'

This would render the same type of template for both tablets and mobile devices.

Release History

Release History

1.0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-adaptive-1.0.2.tar.gz (4.9 kB) Copy SHA256 Checksum SHA256 Source Feb 19, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting