Django

Code

Ticket #4042 (closed: fixed)

Opened 2 years ago

Last modified 2 years ago

Serialization doc: usage of get_serializer()

Reported by: haavikko@gmail.com Assigned to: jacob
Milestone: Component: Documentation
Version: SVN Keywords: serialization
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

serializer_instance.patch (448 bytes) - added by Vinay Sajip <vinay_sajip@yahoo.co.uk> on 04/20/07 02:50:47.
Patch for serialization documentation error

Change History

04/20/07 02:50:47 changed by Vinay Sajip <vinay_sajip@yahoo.co.uk>

  • attachment serializer_instance.patch added.

Patch for serialization documentation error

04/20/07 02:51:36 changed by Vinay Sajip <vinay_sajip@yahoo.co.uk>

  • needs_better_patch changed.
  • needs_tests changed.
  • summary changed from Serialization doc: usage of get_serializer() to [patch] Serialization doc: usage of get_serializer().
  • needs_docs changed.
  • has_patch set to 1.
  • stage changed from Unreviewed to Accepted.

04/20/07 05:28:21 changed by anonymous

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

05/01/07 08:40:30 changed by Vinay Sajip <vinay_sajip@yahoo.co.uk>

  • stage changed from Accepted to Ready for checkin.

05/07/07 22:07:59 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #4042 (Serialization doc: usage of get_serializer())




Change Properties
Action