Storing DTO data in easy-to-use and production-ready Django Model Field with fast [de]serialization.
Project description
django-dto-field
Storing DTO data in easy-to-use and production-ready Django Model Field with fast [de]serialization.
A custom Django Model Field that can serialize and deserialize for different types of DTO (Data-Transfer-Object). DtoField detect DTO type and serialize the most efficiently. Also it has own binary container to maintain data integrity and economical storage.
✨ Features
- All DB support (if DB support BinaryFiled)
- Zip field for size saving (optional)
- Supports pure
dictas DTO - Supports
TypedDictas DTO - Supports
dataclassas DTO - Supports
pydanticas DTO - Supports
marshmallowas DTO - Supports
attrsas DTO - Supports
adapdtixas DTO
⬇️ Install
$ pip install django-dto-field
🚀 Quick start
Set DTO field to your model:
>>> from django.db.models import CharField
>>> from django_dto_field import DtoField
>>> class Country(Model):
... name = CharField()
... city = DtoField()
And than use it:
>>> city = {"name": "Capitol", "districts": [f"d{i}" for i in range(1, 14)]}
>>> created_country = Country.objects.create(name="Panem", city=city)
>>> from_db_country = Country.objects.get(pk=created_country.pk)
>>> assert isinstance(from_db_country.city, dict)
>>> assert from_db_country.city == city
🤗 Author
Made with love by @skv0zsneg
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_dto_field-0.1.0a2.tar.gz.
File metadata
- Download URL: django_dto_field-0.1.0a2.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.0 CPython/3.12.13 Linux/6.17.0-1008-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcaaf11ab86451a43b9f241989ad82cefb9a334336def5a143c891023bb7f2b2
|
|
| MD5 |
910c4201f6c24171bf725c0c1756fe57
|
|
| BLAKE2b-256 |
bef8c9c2312272efbfa5af3329bb7b9f194f56e163cf59026356dc5a6cd51c02
|
File details
Details for the file django_dto_field-0.1.0a2-py3-none-any.whl.
File metadata
- Download URL: django_dto_field-0.1.0a2-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.0 CPython/3.12.13 Linux/6.17.0-1008-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02099c47f759e8d7ce04f56509f2210e1dc0e12cd6c6841ff4800cd55657b57c
|
|
| MD5 |
898a8465848186515fe278726fdb6911
|
|
| BLAKE2b-256 |
806b314ba165fa7068d3ab9bc570b42d471ba40c33a8891e3ea95dfd6650b5fe
|