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

javascript-settings is a Django application that provides a way of passing values backend from Django applications to JavaScript in templates.

Installation

Package

javascript-settings can be installed as a normal Python package.

Example instalation for pip:

$ pip install django-javascript-settings

Example instalation from file:

$ pip install django-javascript-settings-1.1.tar.gz

Configuration

settings.py

Add javascript-settings to INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'javascript_settings',
    ...
)

Add javascript-settings.finders to STATICFILES_FINDERS:

STATICFILES_FINDERS = (
    ...
    'javascript_settings.finders.JavascriptSettingsFinder',
    ...
)

template

You can use one of following ways to pass gathered data to template:

Option 1: Import

Add javascript-settings.js to script imports:

<script type="text/javascript" src="{{ STATIC_URL }}javascript-settings.js"></script>

Option 2: Template tag

Add javascript-settings tag to your main template:

{% load javascript_settings_tags %}
<script type="text/javascript">{% javascript_settings %}</script>

Usage

Configuration is defined by adding javascript_settings function to urls.py of app. javascript_settings should take no arguments and return json-serializable object. Serialized object is then avaliable in Javascript as configuration['app_name'].

If you want to place javascript_settings in different location, then you can define JAVASCRIPT_SETTINGS_SCAN_MODULES as a dictionary of 'app_name': 'module_location'.

Example

Template:

<script type="text/javascript" src="{{ STATIC_URL }}javascript-settings.js"></script>

urls.py in an app “home”:

def javascript_settings():
    return {
        'page_title': 'Home',
        'page_version': '1.9.20',
        'css': {
            'white': './css/white.css',
            'black': './css/black.css',
            'print': './css/print.css',
        },
        'default_css': 'white',
    }

Result in file javascript-settings.js:

var configuration = {'home': {'page_title': 'Home', 'page_version': '1.9.20', 'css': {'white': './css/white.css', 'black': './css/black.css', 'print': './css/print.css'}, 'default_css': 'white'}};
Release History

Release History

1.1.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.1.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.1.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

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

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-javascript-settings-1.1.2.tar.gz (4.8 kB) Copy SHA256 Checksum SHA256 Source Aug 29, 2014

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