Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>One thing to consider is that in python file like objects have an API that is pretty strictly adhered to. This allows code to be very flexible, they are abstractions over I/O streams. These allow your code to not have to worry about where the data is coming from, ie. memory, filesystem, network, etc. </p> <p><a href="http://docs.python.org/2/library/io.html#i-o-base-classes" rel="nofollow">File like</a> objects usually define a couple <a href="http://docs.python.org/2/library/io.html#i-o-base-classes" rel="nofollow">methods</a>, one of which is <code>read</code> </p> <p>I am not sure of the actually implementation of <code>InMemoryUploadedFile</code>, or how they are generated or where they are stored (I am assuming they are totally in memory though), but you can rest assured that they are file like objects and contain a <code>read</code> method, because they adhere to the file api.</p> <p>For the implementation you could start checking out the source:</p> <ul> <li><a href="https://github.com/django/django/blob/master/django/core/files/uploadedfile.py#L90" rel="nofollow">https://github.com/django/django/blob/master/django/core/files/uploadedfile.py#L90</a></li> <li><a href="https://github.com/django/django/blob/master/django/core/files/base.py" rel="nofollow">https://github.com/django/django/blob/master/django/core/files/base.py</a></li> <li><a href="https://github.com/django/django/blob/master/django/core/files/uploadhandler.py" rel="nofollow">https://github.com/django/django/blob/master/django/core/files/uploadhandler.py</a></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload