This serializer support django org data to json or xml
- Python(3.4, 3.5, 3.6)
- Django(1.10, 1.11, 2.0)
pip install django-orm-serializer
- Get single data from django-orm.
serialize_to_dict
This funtion has attributes which help returning data quality.
Option | Help |
---|---|
instance | Django query object |
cur_dept | Starting dept value default=1 |
max_dept | Maximum dept value default=2 |
from ormserializer import Serializer
serializer = Serializer()
data = Model.objects.get(fieald=query)
result_dict = serializer.serialize_to_dict(data)
- Get list data from django-orm.
serialize
This funtion has attributes which help returning array data quality.
Option | Help |
---|---|
qset | Django queryset object |
max_dept | Maximum dept value default=2 |
from ormserializer import Serializer
serializer = Serializer()
data = Model.objects.filter(fieald=query)
result_dict = serializer.serialize(data)