django-responsive

Utilities for building responsive websites in Django
Download

django-responsive Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Mark Lavin
  • Publisher web site:
  • http://bitbucket.org/mlavin/

django-responsive Tags


django-responsive Description

django-responsive a Django app for building responsive websites in Django. This tool is meant to complement the use of CSS media queries and help solve problems with fixed width elements such as advertisements or embedded video.This project does not match devices based on user agent strings and instead uses a small piece of javascript to make the device window size available on the server. Once enabled you can access a device_info dictionary in your templates:{'width': 320, 'type': 'phone', 'height': 480}Now you and conditionally render content based on the device size or type.Installationdjango-responsive requires Python 2.6 or 2.7 and django>=1.3. It is easiest to install django-responsive from PyPi using pip:pip install django-responsiveConfigurationTo enable django-responsive you will need to update your MIDDLEWARE_CLASSES and TEMPLATE_CONTEXT_PROCESSORS settings.:MIDDLEWARE_CLASSES = ( # Other middleware classes go here 'responsive.middleware.DeviceInfoMiddleware',)TEMPLATE_CONTEXT_PROCESSORS = ( # Other context processors included here 'responsive.context_processors.device_info',)Note that TEMPLATE_CONTEXT_PROCESSORS is not included in the default settings and you should be careful to not lose the defaults when adding this additional context processor.There is an optional setting RESPONSIVE_BREAKPOINTS which is used to determine the type included in the device_info dictionary. The default breakpoints are:# Name, Max Width (inclusive)DEFAULT_BREAKPOINTS = { 'phone': 480, 'tablet': 767, 'desktop': None,}Product's homepage


django-responsive Related Software