-------------------------------------------------------
What does it do?
---------------
Makes specified django settings visible in the template rendering context.
How does it do it?
------------------
django-settings-context-processor takes the settings variable
TEMPLATE_VISIBLE_SETTINGS, which should be an iterable of strings,
and looks for a settings of the name of each iterable. The name-value
pair of this setting is then added to the template rendering context.
Can I see an example?
---------------------
Yes! Assuming the root django-settings-context-processor is in your
PYTHON_PATH, this should work:
settings.py:
INSTALLED_APPS = (
......
'settings_context_processor',
)
TEMPLATE_CONTEXT_PROCESSORS = (
# the first 5 here are the django 1.2.1 default context processors
'django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.contrib.messages.context_processors.messages',
......
'settings_context_processor.context_processors.settings',
)
# define some settings we'd like to export
CONTACT_PHONE='(555) 555-5555'
CONTACT_EMAIL='contact@someplace.com
CONTACT_ADDR_STREET='123 Anywhere Rd.'
CONTACT_ADDR_CITYSTATE='Anyplace, AS 12345'
# for settings_context_processor
TEMPLATE_VISIBLE_SETTINGS = (
'CONTACT_PHONE',
'CONTACT_EMAIL',
'CONTACT_ADDR_STREET',
'CONTACT_ADDR_CITYSTATE',
)
some_template.html:
<ul class="contact">
<li>{{ CONTACT_PHONE }}</li>
<li><a href="mailto:{{ CONTACT_EMAIL }}">{{ CONTACT_EMAIL }}</a></li>
<li>{{ CONTACT_ADDR_STREET }}</li>
<li>{{ CONTACT_ADDR_CITYSTATE }}</li>
</ul>
Metadata
Release files for django-settings-context-processor 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-settings-context-processor-0.2.tar.gz | 1.9 kB | Without provenance | Details for django-settings-context-processor-0.2.tar.gz |
Release files / django-settings-context-processor-0.2.tar.gz
| Download URL | django-settings-context-processor-0.2.tar.gz |
|---|---|
| Size | 1.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d37c853d69a3069f5abbf94c7f4f6fc0fac38bbd0524190cd5a250ba800e496a
|
|
BLAKE2b-256 checksum How to use checksums |
ce7cd80d59a2eea6688b9a6a7b6e138749fb906b29f5f9f9eae55ab425e1a110
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-settings-context-processor 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.