Django Model to Python dict serialization mixin.
Project description
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.
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
Hashes for django-model-to-dict-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6334fbe377253649b5277542f6dee3061e65d56e3844483c12a6451abdd3064 |
|
MD5 | a873136730419f007262bb9d25b29c96 |
|
BLAKE2b-256 | 3dc41ac601fde1a51e3ebcf887374867a5d879a2deff48521264f773fcf1a1ee |
Hashes for django_model_to_dict-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf2d24b0ee08ca95f97d33ab78bc29d412c7a7e68e9f49e3e7b4342aa08ead75 |
|
MD5 | a11f654a9eb6fe7484915f9eae2f3618 |
|
BLAKE2b-256 | f9c1563a7f905f92561e39cb85e20daa683b781bc395fada921198746be9e063 |