Code

Opened 7 years ago

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

Download all attachments as: .zip

Change History (5)

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

Patch for serialization documentation error

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

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from Serialization doc: usage of get_serializer() to [patch] Serialization doc: usage of get_serializer()
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 7 years ago by anonymous

  • Summary changed from [patch] Serialization doc: usage of get_serializer() to Serialization doc: usage of get_serializer()

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

  • Triage Stage changed from Accepted to Ready for checkin

comment:4 Changed 7 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.