Extended serializers for Django.
Project description
Extended Django Serializer Module
The wadofstuff.django.serializers python module extends Django’s built-in serializers, adding 3 new capabilities inspired by the Ruby on Rails JSON serializer. These parameters allow the developer more control over how their models are serialized.
The additional capabilities are:
excludes - a list of fields to be excluded from serialization. The excludes list takes precedence over the fields argument.
extras - a list of non-model field properties or callables to be serialized.
relations - a list or dictionary of model related fields to be followed and serialized.
Example of serializing a relation
>>> serializers.serialize('json', Group.objects.all(), indent=4, relations=('permissions',))
[
{
"pk": 2,
"model": "auth.group",
"fields": {
"name": "session",
"permissions": [
{
"pk": 19,
"model": "auth.permission",
"fields": {
"codename": "add_session",
"name": "Can add session",
"content_type": 7
}
}
]
}
}
]
What’s new
Version 1.1.0:
Added support for “natural keys” as implemented in Django.
Version 1.0.0:
First public release.
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
File details
Details for the file wadofstuff-django-serializers-1.1.0.tar.gz.
File metadata
- Download URL: wadofstuff-django-serializers-1.1.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c66d932b4919ce2b0e46585c487c7e4c02cd398b945e364bcdcf9f16d601d35
|
|
| MD5 |
5a934ba7bbab2d6ada114602e6074e85
|
|
| BLAKE2b-256 |
04a133ff36b3e6060ba3f3a08e540406cc2aa28358b114851332189e0d66beb5
|