Opened 18 years ago
Closed 18 years ago
#2701 closed enhancement (fixed)
[patch] Limit which fields are serialized in serializers.serialize.
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Core (Other) | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
After playing with the serializer stuff, I wanted to be able to limit which fields in the model were serialized. The app I
was playing with had a few fields that I didn't need and didn't really want in publicly viewable JavaScript. This would look something like:
serializers.serialize('json', foo.objects.all(), fields=('somefield', 'anotherfield'))
The patch provides "fields" as an optional parameter. Without it, the serializer works as normal.
Attachments (1)
Change History (3)
by , 18 years ago
Attachment: | serialize_limit_by_field.diff added |
---|
comment:1 by , 18 years ago
Summary: | Limit which fields are serialized in serializers.serialize. → [patch] Limit which fields are serialized in serializers.serialize. |
---|
Change summary to reflect patch.
comment:2 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Provides fields as an optional paramter to serializers.serialize.