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.
Metadata
Release files for django-retention-policy 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_retention_policy-0.1.1.tar.gz | 10.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_retention_policy-0.1.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 17.6 kB
Release files / django_retention_policy-0.1.1.tar.gz
| Download URL | django_retention_policy-0.1.1.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
22764abfe94462e655b5eeabdd281bdf57dd8dc8fb0d4d31a6f10149e6c4adc7
|
|
BLAKE2b-256 checksum How to use checksums |
3f8e1bcc059db63d09cbec3115787c1e8aab49f4a579105c6bc1f64a341e6f86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|
Release files / django_retention_policy-0.1.1-py2.py3-none-any.whl
| Download URL | django_retention_policy-0.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
fad97384bd2f7fcf4e504cd5a5cfb6e4ba5b121cf6e75873cf42dbc0023a1feb
|
|
BLAKE2b-256 checksum How to use checksums |
717aacfc904168d054c1dd10276d4e17861e74dce3badb1516d445f2021516fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.10
|