title: how to get (txt) file content from FileField?
body: <p>I have a problem with opening a text file in django that is stored in my database. I want to access it via FileField of my model... the model looks something like this</p>
  
  <pre><code>   class MyModel(models.Model):
        saved_file = FileField()
  </code></pre>
  
  <p>I upload a test file via admin interface, which works ok. In my view I want to access this file. If I open it with standard python open() it works ok...</p>
  
  <pre><code> f = open(path, 'r')
   a = f.readlines()
   return render_to_response('base.html', {'content': a}, context_instance=RequestContext(request))
  </code></pre>
  
  <p>this displays lines of the file ok...
  according to <a href="https://docs.djangoproject.com/en/dev/ref/models/fields/#filefield">https://docs.djangoproject.com/en/dev/ref/models/fields/#filefield</a> one gets a FieldFile proxy when FileField from a model is called, so</p>
  
  <pre><code> f = MyModel.objects.all().get(id=0).saved_file
  </code></pre>
  
  <p>should store FieldFile in f, furthermore documentation states that one opens a file from model by casting .open(mode='rb') on FieldFile, so</p>
  
  <pre><code>file = f.open(mode='rb') 
  </code></pre>
  
  <p>should work like python .open() as stated in the documentation. So to get lines I do</p>
  
  <pre><code>file.readlines()
  </code></pre>
  
  <p>should return me list of lines. What happens is that I get an error saying that .readlines() atribute does not exist. I do not need the file to display it, this is just a way to test if opening a file works, but I need the file content in a variable in my view to further use it in my business logic.
  Could anyone suggest a way to get the file content out of a FileField frem a model?</p>