You can tune Django.js behaviour using settings. Django.js provide the following optionnal settings:
You can specify some libraries versions used by Django.js.
Specify the jQuery version to use. If not specififed, default to last version.
Django.js provide the following versions:
Theses settings allow you to customize or disable Django.js URLs handling.
Default: None
Serialized URLs names whitelist. If this setting is specified, only named URLs listed in will be serialized.
Default: None
Serialized URLs names blacklist. It this setting is specified, named URLs listed in will not be serialized.
Default: None
Serialized namespaces whitelist. If this setting is specified, only URLs from namespaces listed in will be serialized.
Default: None
Serialized namespaces blacklist. If this setting is specified, URLs from namespaces listed in will not be serialized.
Default: False
Serialize unnamed URLs. If this setting is set to True, unnamed URLs will be serialized (only for function based views).
Theses settings allow you to customize or disable Django.js context handling.
default: None
Serialized context variables names whitelist. If this setting is specified, only context variables listed in will be serialized.
Note
LANGUAGE_NAME and LANGUAGE_NAME_LOCAL requires LANGUAGE_CODE to be also included.
Default: None
Serialized context variables names blacklist. If this setting is specified, context variables names listed in will not be serialized.
Note
Excluding LANGUAGE_CODE also exclude LANGUAGE_NAME and LANGUAGE_NAME_LOCAL.
Default: djangojs.utils.ContextSerializer
Change this value if you want to specify a custom context serializer class. The custom class must inherits from ContextSerializer
Default: None
Serialized translations whitelist. If specified, only apps listed in will appear in the javascript translation catalog.
Default: None
Serialized translations blacklist. If specified, apps listed in will not appear in the javascript translation catalog.
Default: tuple()
Custom patterns for localization using the localize management command. Each entry should be a tuple (extension, dirname, pattern) where:
Exemple:
JS_I18N_PATTERNS = (
('hbs', 'static/templates', r'{{#trans}}(.*?){{/trans}}'),
)
Default: 24 * 60 (24 hours)
Django.js urls and context cache duration in minutes.
You could have, in your settings.py:
# Exclude my secrets pages from serialized URLs
JS_URLS_EXCLUDE = (
'my_secret_page',
'another_secret_page',
)
# Only include admin namespace
JS_URLS_NAMESPACES = (
'admin',
)
# Only include my apps' translations
JS_I18N_APPS = ('myapp', 'myapp.other')
# Disable user serialization
JS_USER_ENABLED = False
# Custom Context serializer
JS_CONTEXT_PROCESSOR = 'my.custom.ContextProcessor'