parameters: (self, queryset)
return_statement: return object_data[0]
docstring: Return serialized queryset or single object as python dictionary
          serialize() only works on iterables, so to serialize a single object we put it in a list
docstring_summary: Return serialized queryset or single object as python dictionary
          serialize() only works on iterables, so to serialize a single object we put it in a list
docstring_tokens: Return serialized queryset or single object as python dictionary serialize () only works on iterables so to serialize a single object we put it in a list
function: def serialize_queryset(self, queryset):
          """
          Return serialized queryset or single object as python dictionary
          serialize() only works on iterables, so to serialize a single object we put it in a list
          """
          object_data = []
          is_queryset = False
          query_fields = self.get_fields()
          try:
              iter(queryset)
              is_queryset = True
              raw_data = serializers.serialize(self.serializer_name, queryset, fields=query_fields,
                                               use_natural_keys=self.serialize_natural_keys)
          except TypeError:  # Not iterable
              raw_data = serializers.serialize(self.serializer_name, [queryset, ], fields=query_fields,
                                               use_natural_keys=self.serialize_natural_keys)
  
          for obj in raw_data:  # Add pk to fields
              obj['fields']['pk'] = obj['pk']
              object_data.append(obj['fields'])
  
          if is_queryset:
              return object_data
          return object_data[0]
function_tokens: def serialize_queryset ( self , queryset ) : object_data = [ ] is_queryset = False query_fields = self . get_fields ( ) try : iter ( queryset ) is_queryset = True raw_data = serializers . serialize ( self . serializer_name , queryset , fields = query_fields , use_natural_keys = self . serialize_natural_keys ) except TypeError : # Not iterable raw_data = serializers . serialize ( self . serializer_name , [ queryset , ] , fields = query_fields , use_natural_keys = self . serialize_natural_keys ) for obj in raw_data : # Add pk to fields obj [ 'fields' ] [ 'pk' ] = obj [ 'pk' ] object_data . append ( obj [ 'fields' ] ) if is_queryset : return object_data return object_data [ 0 ]