Opened 20 years ago

Closed 19 years ago

#4042 closed (fixed)

Serialization doc: usage of get_serializer()

Reported by: haavikko@… Owned by: Jacob
Component: Documentation Version: dev
Severity: Keywords: serialization
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

At end of document ​http://www.djangoproject.com/documentation/serialization/
there is example:

json_serializer = serializers.get_serializer("json")
json_serializer.serialize(queryset, ensure_ascii=False, stream=response)

serializers.get_serializer() returns a class object, not actual serializer instance.
The call to json_serializer.serialize fails with:

TypeError: unbound method serialize() must be called with Serializer instance as first argument (got QuerySet instance instead)

Attachments (1)

serializer_instance.patch​ (448 bytes ) - added by Vinay Sajip <vinay_sajip@…> 20 years ago.
Patch for serialization documentation error

Download all attachments as: .zip

Change History (5)

by Vinay Sajip <vinay_sajip@…>, 20 years ago

Attachment: serializer_instance.patch​ added

Patch for serialization documentation error

comment:1 by Vinay Sajip <vinay_sajip@…>, 20 years ago

Has patch: set
Summary: Serialization doc: usage of get_serializer() → [patch] Serialization doc: usage of get_serializer()
Triage Stage: Unreviewed → Accepted

comment:2 by anonymous, 20 years ago

Summary: [patch] Serialization doc: usage of get_serializer() → Serialization doc: usage of get_serializer()

comment:3 by Vinay Sajip <vinay_sajip@…>, 19 years ago

Triage Stage: Accepted → Ready for checkin

comment:4 by Malcolm Tredinnick, 19 years ago

Resolution: → fixed
Status: new → closed

(In [5165]) Fixed #4042 -- Fixed typo in serialization example. Thanks, Vinay Sajip.

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