This release is a pre-release and may not be stable for production use.
Django Frozen Data
Django model custom field for storing a frozen snapshot of an object.
Principles
- Behaves like a
ForeignKeybut the data is detached from the related object - Transparent to the client - it looks and behaves like the original object
- The frozen object cannot be resaved
- Supports nesting of objects
Usage
A frozen field can be declared like a ForeignKey:
class Foo:
frozen_bar = FrozenObjectField(Bar, help_text="This is a frozen snapshot of the object.")
fresh_bar = ForeignKey(Bar, help_text="This is a live FK relationship.")
The field behaves exactly like a FK, with the exception that the object cannot be saved:
>>> bar = Bar()
>>> foo = Foo.objects.create(frozen_bar=bar, fresh_bar=bar)
>>> # the fresh field can be updated as you would expect
>>> foo.fresh_bar.save()
>>> # the frozen field cannot - to prevent overwriting new data.
>>> foo.frozen_bar.save()
>>> StaleObjectError: 'Object was frozen; defrosted objects cannot be saved.'
Issues - TODO
- Deserialization of DateField/DateTimeField values
- Deserialization of DecimalField values
- Deserialization of UUIDField values
- Deep object freezing
Running tests
The tests themselves use pytest as the test runner. If you have installed the poetry evironment, you can run them thus:
$ poetry run pytest
Metadata
Release files for djang-frozen-data 0.1a1
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 |
|---|---|---|---|---|
| djang-frozen-data-0.1a1.tar.gz | 5.2 kB | Without provenance | Details for djang-frozen-data-0.1a1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| djang_frozen_data-0.1a1-py3-none-any.whl | Python 3 | none | any | Details for djang_frozen_data-0.1a1-py3-none-any.whl |
Total release size: 11.2 kB
Release files / djang-frozen-data-0.1a1.tar.gz
| Download URL | djang-frozen-data-0.1a1.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07745cb4f316b5217725813373a49760951a5c716f36cf16a04ec9de7981a01b
|
|
BLAKE2b-256 checksum How to use checksums |
2668b5823f73e4a68ffb3bdaf27f820ca2f482e46d468f39281e227f24c1d20f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.6 CPython/3.9.4 Darwin/20.5.0
|
Release files / djang_frozen_data-0.1a1-py3-none-any.whl
| Download URL | djang_frozen_data-0.1a1-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b43b1748fcddc229bac20f146e02cffe350369a14aa58ed69a135ffa9cf66dda
|
|
BLAKE2b-256 checksum How to use checksums |
f8db4ab298fe8a305a1d54b86026e48f23d188f967058cfd9ec010d2a01a84b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.6 CPython/3.9.4 Darwin/20.5.0
|
Security for djang-frozen-data 0.1a1
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.