<commit_before>Django Client Data
==================

This allows Django to pass data to the browser.

Installation
------------

To get the latest stable release from PyPi

.. code-block:: bash

    pip install django_client_data

Add ``django_client_data`` to your ``INSTALLED_APPS``

.. code-block:: python

    INSTALLED_APPS = (
        ...,
        'django_client_data',
    )

Install middleware.

Install context processor.

Usage
-----

Call ``set_client_data()``.

Include ``client_data.html`` in your page.

Settings
--------

CLIENT_DATA_NAMESPACE, defaults to 'DJANGO', the data is a property of this name
named 'client_data'.

Mechanism
---------

Django Client Data works by attaching a ``client_data`` attribute on the request
object.  The ``client_data.html`` template attaches a ... to the JavaScript
global indicated by CLIENT_DATA_NAMESPACE.

Todo
----

* add a "context processors" feature to client data so custom values can be
injected

Run Tests
---------

.. code-block:: bash

    ./configure.sh
    source venv/bin/activate
    python django_client_data/tests/manage.py test
<commit_msg>edited readme<commit_after>Django Client Data
==================

This allows Django to pass data to the browser.

Installation
------------

To get the latest stable release from PyPi

.. code-block:: bash

    pip install django_client_data

Install the app, middleware, and context processor

.. code-block:: python

    INSTALLED_APPS = (
        ...,
        'django_client_data',
    )

    MIDDLEWARE_CLASSES = (
        ...
        'django_client_data.middleware.ClientDataMiddleware',
    )

    TEMPLATE_CONTEXT_PROCESSORS = (
        ...
        'django_client_data.context_processors.client_data_context_processor',
    )

Usage
-----

Call ``set_client_data()``.

Include ``client_data.html`` in your page.

Settings
--------

CLIENT_DATA_NAMESPACE, defaults to 'DJANGO', the data is a property of this name
named 'client_data'.

Mechanism
---------

Django Client Data works by attaching a ``client_data`` attribute on the request
object.  The ``client_data.html`` template attaches a ... to the JavaScript
global indicated by CLIENT_DATA_NAMESPACE.

Todo
----

* add a "context processors" feature to client data so custom values can be
injected

Run Tests
---------

.. code-block:: bash

    ./configure.sh
    source venv/bin/activate
    python django_client_data/tests/manage.py test

{'fraction_non_alphanumeric': 0.12903225806451613, 'fraction_numerical': 0.0, 'mean_word_length': 2.946166394779772, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2293781', 'n_tokens_mistral': 736, 'n_tokens_neox': 706, 'n_words': 230}