Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mlynch/wadofstuff-django-serializers
Legacy Django thing, ignore
https://github.com/mlynch/wadofstuff-django-serializers
Last synced: 21 days ago
JSON representation
Legacy Django thing, ignore
- Host: GitHub
- URL: https://github.com/mlynch/wadofstuff-django-serializers
- Owner: mlynch
- License: bsd-3-clause
- Created: 2014-11-01T01:05:28.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-11-01T01:06:46.000Z (about 10 years ago)
- Last Synced: 2024-12-05T11:04:20.548Z (29 days ago)
- Language: Python
- Size: 133 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: ChangeLog
- License: LICENSE
Awesome Lists containing this project
README
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
}
}
]
}
}
]