title: TypeError at /1 argument should be string, bytes or integer, not Download
body: <p>I want to serve my download files from the media files and the files are being uploaded through from the admin. I tried something and I'm getting this error</p>
  
  <pre><code>TypeError at /1
  
  argument should be string, bytes or integer, not Download
  </code></pre>
  
  <p>below are my codes.</p>
  
  <p><strong>view.py</strong></p>
  
  <pre><code>    def download(request, download_id):
          downloading = Download.objects.get(pk=download_id)
          if os.path.exists(downloading):
          with open(downloading, 'rb') as fh:
              response = HttpResponse(fh.read(), content_type="text/pdf")
              response['Content-Disposition'] = 'inline; filename=' + os.path.basename(downloading)
              response['Content-Length'] = os.path.getsize(downloading)
              return response
          pdf.closed
      raise Http404
  </code></pre>
  
  <p><strong>url.py</strong></p>
  
  <pre><code>    url(r'^(?P&lt;download_id&gt;\d+)$', views.download, name='download'),
  </code></pre>
  
  <p><strong>html link</strong></p>
  
  <pre><code>    &lt;a href="{% url 'peruse:download' download.id %}" class="btn btn-generic btn-sm" role="button"&gt;DOWNLOAD&lt;/a&gt;
  </code></pre>
  
  <p><strong>model.py</strong></p>
  
  <pre><code>    class Download(models.Model):
          pdf_name = models.CharField(max_length=500, blank=False)
          pdf_file = models.FileField(upload_to='Downloads/%d-%m-%Y/', blank = False,)
          created_at = models.DateTimeField(auto_now_add = True)
          updated_at = models.DateTimeField(auto_now = True)
          is_visible = models.BooleanField(default = True)
  
          def __str__(self):
              return self.pdf_name
  </code></pre>
  
  <p>and this view handles the upload.</p>
  
  <pre><code>    def upload(request):
          uploading = Download.objects.filter(is_visible = True)
          context = { 'uploading' : uploading }
          fillAuthContext(request, context)
          return render(request, 'library/resources.html', context)
  </code></pre>