djangocms-blog-expiry-date
Extension for django CMS blog that adds an optional expiry date per post.
Installation
-
Install the package:
python3 -m pip install djangocms-blog-expiry-date
-
Add it to
INSTALLED_APPS:"djangocms_blog_expiry_date",
-
Run migrations:
python3 manage.py migrate djangocms_blog_expiry_date
-
Update your templates to load the templatetag, and use it to test if the post is expired
{% load djangocms_blog_expiry_date_tags %} {% post_expiry_expired post as post_expired %} {% if post_expired %} {# show a notice, or hide booking links, etc. #} {% endif %}
Behaviour
post_expiry_expired (Python)
djangocms_blog_expiry_date.utils.post_expiry_expired(post) returns:
Trueif an extension linked toposthas_meta.app_label == 'djangocms_blog_expiry_date'andis_expired()isTruefor that instance.FalseifpostisNone, there is no such extension,expiry_dateis empty, or the date is still in the future.
Extensions whose model belongs to another app are ignored (so several extension types can coexist on the same post).
Template tag
Load the tag library, assign the result, then branch (simple tags must use the as form to work inside {% if %}):
{% load djangocms_blog_expiry_date_tags %}
{% post_expiry_expired post as post_expired %}
{% if post_expired %}
{# show a notice or hide booking links, etc. #}
{% endif %}
This uses the same rules as post_expiry_expired() above.
Calling is_expired on a single extension
If you know the extension is this app’s model (e.g. only one extension type), you can still use:
{% with ext=post.extension.first %}
{% if ext and ext.is_expired %}
…
{% endif %}
{% endwith %}
Optional settings
Multisite
With BLOG_MULTISITE = True, the app registers a get_sites function on the user model (see apps.py), using django CMS global page permissions.
Tests
Install test dependencies using the following commands:
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install -e ".[test]"
Launch tests using these commands:
. .venv/bin/activate
pytest
Metadata
Release files for djangocms-blog-expiry-date 0.0.3
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 |
|---|---|---|---|---|
| djangocms_blog_expiry_date-0.0.3.tar.gz | 23.0 kB | Without provenance | Details for djangocms_blog_expiry_date-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| djangocms_blog_expiry_date-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for djangocms_blog_expiry_date-0.0.3-py3-none-any.whl |
Total release size: 48.3 kB
Release files / djangocms_blog_expiry_date-0.0.3.tar.gz
| Download URL | djangocms_blog_expiry_date-0.0.3.tar.gz |
|---|---|
| Size | 23.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bafcd543c43613d20c6fe6cb7503542f464126c9fbf94822b1c8d9eb12f077dd
|
|
BLAKE2b-256 checksum How to use checksums |
212e95a866419e99c27f20c32b9af7ff25fa2dcebaa0f3062baf520db76d8656
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|
Release files / djangocms_blog_expiry_date-0.0.3-py3-none-any.whl
| Download URL | djangocms_blog_expiry_date-0.0.3-py3-none-any.whl |
|---|---|
| Size | 25.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
88a96cf956a8ee9b98af36603d35dad6c2bc91a5db6efc2e2ee35e8762fbb02c
|
|
BLAKE2b-256 checksum How to use checksums |
1b443d5d46abee61e5800dd8ca9a76efe0889fbb6dc28daaf1d47bded23ace6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.2
|
Security for djangocms-blog-expiry-date 0.0.3
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.