title: Django, viewing uploaded files and videos
body: <p>I would like to be able to view my uploaded files. I really have a poor grasp of what I am doing. </p>
  
  <p>views.py </p>
  
  <pre><code>def upload_file(request):
      if request.method == 'POST':
          form = DocumentForm(request.POST, request.FILES)
          if form.is_valid():
              form.save() 
              return HttpResponseRedirect(reverse('learning_logs:topics')) 
      else:
          form = DocumentForm()
      return render(request, 'learning_logs/model_form_upload.html', {'form':form}) 
  
  
  def file_preview(request):
      videos = Document.objects.all()     
      context = {'videos':videos} 
      return render(request, 'learning_logs/video.html', context) 
  </code></pre>
  
  <p>models.py </p>
  
  <pre><code>class Document(models.Model):
      docfile = models.FileField(upload_to = 'documents/')
      upload_at = models.DateTimeField(auto_now_add = True)
  </code></pre>
  
  <p>forms.py    </p>
  
  <pre><code>class DocumentForm(forms.ModelForm):
      class Meta:
          model = Document 
          fields = ['docfile'] 
  </code></pre>
  
  <p>I have uploaded videos and pictures.  </p>
  
  <p>As the files are passed onto the HTML, I can only see the names of the files I uploaded. I can't click on the links and view the files.</p>
  
  <p>I would like to have an actual video player to play the videos, or view the pictures. </p>