mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 09:57:55 +03:00 
			
		
		
		
	Use the BytesIO for buffering bytes and import the one from the compat module.
This commit is contained in:
		
							parent
							
								
									8894019899
								
							
						
					
					
						commit
						8026480454
					
				| 
						 | 
				
			
			@ -183,9 +183,9 @@ At this point we've translated the model instance into Python native datatypes.
 | 
			
		|||
 | 
			
		||||
Deserialization is similar.  First we parse a stream into Python native datatypes... 
 | 
			
		||||
 | 
			
		||||
    import StringIO
 | 
			
		||||
    from rest_framework.compat import BytesIO
 | 
			
		||||
 | 
			
		||||
    stream = StringIO.StringIO(content)
 | 
			
		||||
    stream = BytesIO(content)
 | 
			
		||||
    data = JSONParser().parse(stream)
 | 
			
		||||
 | 
			
		||||
...then we restore those native datatypes into to a fully populated object instance.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user