mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #26717 -- Added Serializer.stream_class to customize the stream.
This commit is contained in:
committed by
Tim Graham
parent
7767978bee
commit
724dd2043e
@@ -59,6 +59,7 @@ class Serializer(object):
|
||||
# internal Django use.
|
||||
internal_use_only = False
|
||||
progress_class = ProgressBar
|
||||
stream_class = six.StringIO
|
||||
|
||||
def serialize(self, queryset, **options):
|
||||
"""
|
||||
@@ -66,7 +67,7 @@ class Serializer(object):
|
||||
"""
|
||||
self.options = options
|
||||
|
||||
self.stream = options.pop("stream", six.StringIO())
|
||||
self.stream = options.pop("stream", self.stream_class())
|
||||
self.selected_fields = options.pop("fields", None)
|
||||
self.use_natural_foreign_keys = options.pop('use_natural_foreign_keys', False)
|
||||
self.use_natural_primary_keys = options.pop('use_natural_primary_keys', False)
|
||||
|
||||
Reference in New Issue
Block a user