Skip to main content

django-resumable

Build Status

django-resumable provides django backend stuff that handles resumable.js xhr uploads.

Installation

  • pip install django-resumable

  • Add resumable to your INSTALLED_APPS

Views

In order to upload files asynchronous, you must define an endpoint that will deal with uploaded file chunks:

from django.contrib.auth.decorators import login_required

from resumable.views import ResumableUploadView


urlpatterns += 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 self.request.user.profile.chunks_dir

Fields

If you want to handle resumable upload within your forms, you can use the ResumableFileField that works like django core FileField:

from django.conf import settings
from django.core.urlresolvers import reverse

from resumable.fields import ResumableFileField


class ResumableForm(Form):
    file = ResumableFileField(
        allowed_mimes=("audio/ogg",),
        upload_url=lambda: reverse('upload'),
        chunks_dir=getattr(settings, 'FILE_UPLOAD_TEMP_DIR')
    )

Javascript

django-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>

Metadata

Release files for django-resumable 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-resumable 0.2.0
File Size Uploaded Provenance Actions
django-resumable-0.2.0.tar.gz 17.2 kB Without provenance Details for django-resumable-0.2.0.tar.gz

Release files / django-resumable-0.2.0.tar.gz

Download URL django-resumable-0.2.0.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d19b95b4d6cf8eb2b92cf288acfc232219544284ad2b06a9af389f55362e3855
BLAKE2b-256 checksum
How to use checksums
3574c210648c24e0ec29b246bad27acb114d1676d6526c76d8abdb49e429e51a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-resumable 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page