Site Parameters
Site Parameters is a simple Django app to store customized site-level content, so that it can be maintained from the Admin by content managers.
This includes:
- Basic "key, value" settings for common data types;
- Simple Navigation menus;
- Management of Social Media locations for the site.
All data are available to all templates through a context processor.
As an example, you can have your site's copyright message as a SiteParameterString object rather than hard-coding it into a global footer template. Or, you can upload a "site canonical image" that would be used as a placeholder in situations where an image in a template isn't available.
Quick start
-
Add "site_parameters" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [ ... 'site_parameters', ] -
Add the context_processors to the system context_processors in the settings file like this::
TEMPLATES = [ { ... 'OPTIONS': { 'context_processors': [ ... 'site_parameters.context_processors.get_custom_site_parameters', ] ... }, ... } ] -
Run
python manage.py migrateto create the database tables. -
Start the development server and visit
http://127.0.0.1:8000/admin/to see the available models.
Basic Site Parameters
You can add site parameters of the following types:
- Integers
- Strings
- Text blocks
- URLs
- Switches (booleans)
- Images
(At present, there's no Markdown or HTML support as both of these would require other components to be installed.)
In general, each has the following fields:
- Title
- Slug (automatically generated from the title, but can be over-ridden)
- Value
The title (for the most part) is just to make it easy to remember what the parameter is for (although it can be used in templates, etc. in the "regular" way).
The slug is what's used in the global context for all templates. Any hyphens are converted to underscores. So if you have a Site: String with:
- title = "Copyright Notice"
- slug = "copyright-notice", and
- value = "2019 Skepsis Interplanetary"
then you can use {{ site_parameter_string.copyright_notice }} in any template.
Social Media
The Social Media model holds information about your site's external social media pages. This is a convenience for being able to, e.g., manage lists of social media icons on pages, easily add or delete them as new services emerge and become popular, etc.
Each of the items in the Social Media list have a field to enter an SVG icon.
The "Order in List" field handles ordering.
The "Available" field handles which items will be shown on the site.
In templates, you can access the information from {{ global_social_media_dict.slug }}.
Navigation
Navigation Menus are constructed by assembling sets of Navigation Items. You can have as Navigation Menus as you need.
If you are also using Django CMS: the URL Slug field can be used to reference CMS Page objects. Otherwise you can put in a root-relative URL in the Internal Link field.
The ordered list of navigation items can be accessed in a template from the context name global_nav_ + slug, e.g., global_nav_footer.
Metadata
Release files for django-site-parameters 0.1.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-site-parameters-0.1.4.tar.gz | 10.8 kB | Without provenance | Details for django-site-parameters-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_site_parameters-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for django_site_parameters-0.1.4-py3-none-any.whl |
Total release size: 26.0 kB
Release files / django-site-parameters-0.1.4.tar.gz
| Download URL | django-site-parameters-0.1.4.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f7554882ad6d8cad9d2e35a3eeed363729008454f705f4820eef77da332bc251
|
|
BLAKE2b-256 checksum How to use checksums |
d86e2afb7ac95912c526f56f68db7885bcd283646903a837d3a14324bfb74b34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5
|
Release files / django_site_parameters-0.1.4-py3-none-any.whl
| Download URL | django_site_parameters-0.1.4-py3-none-any.whl |
|---|---|
| Size | 15.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
66892d4e6b44730d72a2de430193e318e1c4e0b0aefb432cb3cc94d3ce0219d9
|
|
BLAKE2b-256 checksum How to use checksums |
043c729ff4a6378789225263299163bad18192ecb4899c8eb126eec956c9ae9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5
|
Security for django-site-parameters 0.1.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.