title: Django Upload/Download File
body: <p>I am new to django. In my project I need to add user forms to upload some files and download the uploaded files.</p>
  <p>Consider this as an online storage space.
  This needs to be handled by class based views so that expansion of the views will be easy.</p>
  <p>As of now I tried django-downloadview for objectdownloadview
  <a href="https://django-downloadview.readthedocs.io/en/1.9/views/object.html" rel="nofollow noreferrer">https://django-downloadview.readthedocs.io/en/1.9/views/object.html</a>
  This works quite fine with the example. But I am not able to expand it for class based views for my project.
  More over example is with slug I tried changing it to PK but its throwing errors.</p>
  <p>I tried below code from django-downloadview example:-</p>
  <h1>Views.py</h1>
  <pre><code>from django_downloadview import ObjectDownloadView
  
  from .models import Document
  
  
  default_file_view = ObjectDownloadView.as_view(model=Document)
  </code></pre>
  <p>Models.py</p>
  <pre><code>from django.db import models
  
  
  class Document(models.Model):
      slug = models.SlugField()
      file = models.FileField(upload_to='object')
  </code></pre>
  <p>urls.py</p>
  <pre><code>from django.conf.urls import  url
  
  from .views import *
  
  
  urlpatterns = [
      url(r'^object/(?P&lt;slug&gt;[a-zA-Z0-9_-]+)/$',default_file_view,name='object'),
  ]
  </code></pre>
  <p>Can someone please help me here Or share a working example of simple 1 page django file upload and download stuff.</p>
  <p>Regards,
  Jaiswal</p>