Django Settings Resolver
The siple way to resolve some data defined on settings. You can easy to use it on any part of you python code on your django project.
Also, this exposeses templatetags for django template engine and jinja template enjine for easy use it from templates. See examples to better understand how it works.
How to install
You can also install it with: pip install django-sr
Configuration
Add the sr app to your installed apps and define your settings SR variable as a dictionary.
Example:
# settings.py
SR = {
'footer': {
'phone': '+34 987654321',
'address': 'Foo Bar Street, 32',
'other_text': 'Text with parameters {0}',
},
'header': {
'logo': {
'alt': 'Logo image',
'src': 'http://foo.bar/images/logo.png'
}
}
}
Usage examples
Use it directly from your code.
from sr import sr
logo_alt = sr('header.logo.alt') # Logo image
other_text = sr('footer.other_text', 'parameter') # Text with parameters parameter
Also, from django templates with the sr template tag:
{% load sr %}
<span class="phone">{% sr 'footer.phone' %}</span>
<span class="other">{% sr 'footer.other_text' 'text' %}</span>
And you can use it from jinja templates using the sr global function:
<span class="phone">{{ sr('footer.phone') }}</span>
<span class="other">{{ sr('footer.other_text', 'text') }}</span>
For jinja template integration for django you need use django-jinja
Metadata
Release files for django-sr 0.0.4
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-sr-0.0.4.tar.gz | 3.6 kB | Without provenance | Details for django-sr-0.0.4.tar.gz |
Release files / django-sr-0.0.4.tar.gz
| Download URL | django-sr-0.0.4.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3586b852ae8af1b4b2796590534b0b867b523f47a5779b2ccb6ce010efc57e34
|
|
BLAKE2b-256 checksum How to use checksums |
3bda7d19c3d34a0f7180530733abdd0bbd0742de4a0fce51883a0e7f65ae6a4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-sr 0.0.4
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.