django-resumable

Django resumable uploads
Download

django-resumable Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Price:
  • FREE
  • Publisher Name:
  • Jean-Philippe Serafin
  • Publisher web site:
  • https://github.com/jean-philippe/

django-resumable Tags


django-resumable Description

django-resumable is a Django app that provides Django backend stuff that handles resumable.js xhr uploads.Installation- pip install django-resumable- Add resumable to your INSTALLED_APPSViewsIn order to upload files asynchronous, you must define an endpoint that will deal with uploaded file chunks:from django.contrib.auth.decorators import login_requiredfrom resumable.views import ResumableUploadViewurlpatterns += patterns('', url(^upload/$', login_required(ResumableUploadView.as_view()), name='upload'),)You should also consider having per user chunk upload directory:class MyResumableUploadView(ResumableUploadView): @property def chunks_dir(self): return request.user.profile.chunks_dirFieldsIf you want to handle resumable upload within your forms, you can use the ResumableFileField that works like django core FileField:from django.conf import settingsfrom django.core.urlresolvers import reversefrom resumable.fields import ResumableFileFieldclass ResumableForm(Form): file = ResumableFileField( allowed_mimes=("audio/ogg",), upload_url=lambda: reverse('upload'), chunks_dir=getattr(settings, 'FILE_UPLOAD_TEMP_DIR') )Javascriptdjango-resumable comes with extendable frontend scripts that work out of the box:{% load staticfiles %}< !DOCTYPE html >< html > < body > < form method="post" action="." > < fieldset > {% csrf_token %} {{ form.as_p }} < /fieldset > < p >< input type="submit" value="send" / >< /p > < /form > < script type="text/javascript" src="https://raw.github.com/23/resumable.js/master/resumable.js" >< /script > < script type="text/javascript" src="{% static 'resumable/js/django-resumable.js' %}" >< /script > < script type="text/javascript" src="{% static 'resumable/js/init.js' %}" >< /script > < /body >< /html >Product's homepage


django-resumable Related Software