ognajDv0.2.4
Django app which handles ORM objects' versions.
Description
ognajD is Django-compactible application which handles versionning for ORM models. Main feature is for ognjaD to be a "plug-in" Django application, thus capable to work with "little-to-no" configuring and changes to Django project.
Features
ognajd stores objects' versions in own table, relied on contenttypes application.
ognajD @ v0.2.4 can:
- catch object's save / update signals
- store snapshot of object in DB with:
- timestamp
- serialized version
- hash
- object version may be serialized (currently, only JSON) as:
- diff with previous version (by default)
- raw dumps
- inline with versione for admin models
Usage example
sample-project is a showcase django project, based on famous
polls application.
You can reference to it for usage cases, examples, testing.You must never deploy sample_project in
production due to exposed SECRET_KEY.
Getting Started
Dependencies
Python packages
django~=3.2.7might work on lesser versions, not testedjsondiff~=1.3.0might work on lesser versions, not tested
Django applications
contenttypes
Installing
Using Python Package Index
-
make sure to use latest
pip:python3 -m pip install --upgrade pip
-
install
django-ognajd:python3 -m pip install django-ognajd
OR download package from releases
-
download release asset (
.tar.gzor.whl) -
make sure to use latest
pip:python3 -m pip install --upgrade pip
-
install
django-ognajdfrom file:python3 -m pip install /path/to/downloaded/asset.tar.gz # or .whl
OR clone from repository
-
clone project:
git clone \ --depth=1 \ --branch=master \ git@github.com:omelched/django-ognajd.git \ </path/to/downloads>
-
move
/django-ognajd/ognajdsolely to folder containing django appsmv </path/to/downloads>/django-ognajd/ognajd \ </path/to/django/project/apps>
-
remove leftovers
rm -rf </path/to/downloads>/django-ognajd
Configuring
Installing application
Add ognajd to INSTALLED_APPS in your Django project settings.py.
Make sure it is installed before django.contrib.admin.
If you installed package the third way, </path/to/django/project/apps>
must be added to PYTHONPATH. If you not sure add code below in your Django project manage.py before calling main():
sys.path.append('</path/to/django/project/apps>')
Registering models
To register your model as eligible for versioning add attribute-class VersioningMeta to model class definition.
For typing, linters, autocompletion tyou can inherit from ognajd.models.VersioningMeta.
Then set preferred options.
e.g:
# .../your_app/models.py
from django.db import models
from ognajd.models import VersioningMeta
class Question(models.Model):
class VersioningMeta(VersioningMeta):
store_diff = False
... # fields' definitions
VersioningMeta options
| Name | Description | Type | Default |
|---|---|---|---|
enabled |
True: if model will be versioned False: if will not |
bool |
True |
store_diff |
True: model's history will be stored as diffs False: as dumps |
bool |
True |
save_empty_changes |
True: if empty changes will be registered False: if will not |
bool |
True |
Authors
@omelched (Denis Omelchenko)
Contributors
Changelist
ognajD version history and changelist available at releases page.
License
This project is licensed under the GNU APGLv3 License - see the LICENSE file for details.
Acknowledgments
Inspiration, code snippets, etc.
- polls showcase app code from sample-django
- index incrementer at model save from
tinfoilboy
Metadata
Release files for django-ognajd 0.2.8
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_ognajd-0.2.8.tar.gz | 22.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_ognajd-0.2.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 55.3 kB
Release files / django_ognajd-0.2.8.tar.gz
| Download URL | django_ognajd-0.2.8.tar.gz |
|---|---|
| Size | 22.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
89f6da55493c0533b6bed57d5cff471aad9750cfc632610a8ce5f703441c7ca9
|
|
BLAKE2b-256 checksum How to use checksums |
478b369a3d0edd42e2c0567253abb43a871fc8466cbbfe80d815a9ba291af6ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Release files / django_ognajd-0.2.8-py3-none-any.whl
| Download URL | django_ognajd-0.2.8-py3-none-any.whl |
|---|---|
| Size | 32.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6625849afeb73656d173de39ed0be02bea55a01adc3c94b037f931ca4b3baa89
|
|
BLAKE2b-256 checksum How to use checksums |
1df79bae39ac855513dce3244d8c0605ee3fd290dbb86dabb3666307892f5568
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|