Opened 18 years ago

Closed 18 years ago

#2701 closed enhancement (fixed)

[patch] Limit which fields are serialized in serializers.serialize.

Reported by: deryck@… 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)

serialize_limit_by_field.diff (1.3 KB ) - added by deryck@… 18 years ago.
Provides fields as an optional paramter to serializers.serialize.

Download all attachments as: .zip

Change History (3)

by deryck@…, 18 years ago

Provides fields as an optional paramter to serializers.serialize.

comment:1 by deryck@…, 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 Jacob, 18 years ago

Resolution: fixed
Status: newclosed

(In [4042]) Fixed #2701: Added "fields" argument to serializers.serialize. Thanks, Deryck.

Note: See TracTickets for help on using tickets.
Back to Top