Opened 10 years ago

Closed 10 years ago

#4042 closed (fixed)

Serialization doc: usage of get_serializer()

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

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@…> 10 years ago.
Patch for serialization documentation error

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by Vinay Sajip <vinay_sajip@…>

Attachment: serializer_instance.patch added

Patch for serialization documentation error

comment:1 Changed 10 years ago by Vinay Sajip <vinay_sajip@…>

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

comment:2 Changed 10 years ago by anonymous

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

comment:3 Changed 10 years ago by Vinay Sajip <vinay_sajip@…>

Triage Stage: AcceptedReady for checkin

comment:4 Changed 10 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

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

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