Django Model to Python dict serialization mixin.
Based on the original gist: https://gist.github.com/gbezyuk/de29d4888818b87f8addd8143b5331e0
Requirements
Currently the package is tested with Python3 and Django 1.10 only.
Documentation
The full documentation is at https://django-model-to-dict.readthedocs.io.
Quickstart
Install Django-Model-To-Dict:
pip install django-model-to-dict
Add it to your INSTALLED_APPS:
INSTALLED_APPS = (
...
'django_model_to_dict.apps.DjangoModelToDictConfig',
# or just 'django_model_to_dict'
...
)
Use ToDictMixin with your model:
from django_model_to_dict.mixins import ToDictMixin
from django.db import models
class YourModel(models.Model, ToDictMixin):
pass
Since now you model’s instances have the to_dict method defined.
You can setup additional settings both in your global project configuration or in a particular model. See docs for more details.
Features
TODO
Running Tests
Does the code actually work?
source <YOURVIRTUALENV>/bin/activate (myenv) $ pip install tox (myenv) $ tox
Credits
Tools used in rendering this package:
History
0.1.0 (2016-12-15)
First release on PyPI.
Release files for django-model-to-dict 0.2.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-model-to-dict-0.2.1.tar.gz | 10.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_model_to_dict-0.2.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 21.3 kB
Release files / django-model-to-dict-0.2.1.tar.gz
| Download URL | django-model-to-dict-0.2.1.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bffc08dc3631f7ce82885f6a3fe6f7b5bf2b135265b68c3f35c02181c9c0e9c2
|
|
BLAKE2b-256 checksum How to use checksums |
39a168d2cbb58005a7ec6e6d3662fd80546a6f87f76aead0225a1891e0175ccb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_model_to_dict-0.2.1-py2.py3-none-any.whl
| Download URL | django_model_to_dict-0.2.1-py2.py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
079bbe20d2e7018676e437f0cb83bd8b0092a69fbe796bf271d528e29ebbe1fb
|
|
BLAKE2b-256 checksum How to use checksums |
ac8cf1d9c04dbe60f76e7bde4ac4554d92aa4ba92fc9a76cbfccc1abb0cbef2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |