A Django Management Command to rename existing Django Applications.
Project description
django-retention-policy
Deletes Django database records according to a retention policy of your choice.
Installation
First of all you need your Django application setup with Celery. With both a worker process and a Celery beat process.
Then proceed to install the package.
pip install django-retention-policy
And setup the periodic Celery task, in your settings.py:
from datetime import timedelta
EIGHT_WEEKS_IN_SECS = 86400 * 7 * 8
CELERY_BEAT_SCHEDULE = {
'periodic-task_delete_expired_db_records': {
'task': 'django_retention_policy.task_delete_expired_db_records',
'schedule': timedelta(hours=12),
'kwargs': {
'app_name': 'django_app_name_here',
'model_name': 'YourDjangoModelNameHere',
'time_based_column_name': 'timestamp',
'data_retention_num_seconds': EIGHT_WEEKS_IN_SECS,
},
},
}
CELERY_IMPORTS = (
'django_retention_policy',
)
That's it. Start up your Celery worker, and Celery beat processes and the automatic deletion will take place according to your configuration.
Release History
0.1.1 (2022-08-10)
- Documentation fixes.
0.1.0 (2022-08-10)
- Initial release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django_retention_policy-0.1.1.tar.gz
.
File metadata
- Download URL: django_retention_policy-0.1.1.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22764abfe94462e655b5eeabdd281bdf57dd8dc8fb0d4d31a6f10149e6c4adc7 |
|
MD5 | 9350fbe7e4f81dcf4b888ed195e05537 |
|
BLAKE2b-256 | 3f8e1bcc059db63d09cbec3115787c1e8aab49f4a579105c6bc1f64a341e6f86 |
File details
Details for the file django_retention_policy-0.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: django_retention_policy-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fad97384bd2f7fcf4e504cd5a5cfb6e4ba5b121cf6e75873cf42dbc0023a1feb |
|
MD5 | 711a4ec01a7f5b3e60bbcb984cbe11cb |
|
BLAKE2b-256 | 717aacfc904168d054c1dd10276d4e17861e74dce3badb1516d445f2021516fb |