Skip to main content

This is a Django integration of Fine Uploader JavaScript Upload Library.

https://img.shields.io/pypi/v/django-fineuploader.svg https://img.shields.io/pypi/dm/django-fineuploader.svg https://img.shields.io/github/license/bashu/django-fineuploader.svg

Installation

pip install django-fineuploader

External dependencies

  • jQuery - This is not included in the package since it is expected that in most scenarios this would already be available.

Setup

Add fineuploader and fineuploader.ajaxuploader to INSTALLED_APPS:

INSTALLED_APPS += (
    'fineuploader',
    'fineuploader.ajaxuploader',
)

Be sure you have the django.template.context_processors.request processor

TEMPLATES = [
    {
        ...
        'OPTIONS': {
            'context_processors': [
                ...
                'django.template.context_processors.request',
            ],
        },
    },
]

Update your urls.py file:

urlpatterns += [
    url(r'^fineuploader/', include('fineuploader.urls')),
]

and include fineuploader templates

{% include "fineuploader/fineuploader_css.html" %} {# Before the closing head tag #}
{% include "fineuploader/fineuploader_js.html" %} {# Before the closing body tag #}

When deploying on production server, don’t forget to run:

python manage.py collectstatic

Usage

# forms.py

from django import forms

from fineuploader.forms import FineFormMixin
from fineuploader.formfields import FineFileField

class ExampleForm(FineFormMixin, forms.ModelForm):

    files = FineFileField(label="Files")

    class Meta:
        ...

    def save(self, *args, **kwargs):
        obj = super(ExampleForm, self).save(commit=True)

        self.handle_upload(obj, self.request)  # handle uploaded files

        self.delete_temporary_files()  # deleting temporary files / objects

        return obj

# views.py

from django.views import generic
from django.contrib.auth.mixins import LoginRequiredMixin

class ExampleCreateView(LoginRequiredMixin, generic.CreateView):
    form_class = ExampleForm  # our custom form class
    ...

    def get_form_kwargs(self):
        kwargs = super(ExampleCreateView, self).get_form_kwargs()
        kwargs.update({"request": self.request})  # must pass self.request into form
        return kwargs

class ExampleUpdateView(LoginRequiredMixin, generic.UpdateView):
    form_class = ExampleForm  # our custom form class
    ...

    def get_form_kwargs(self):
        kwargs = super(ExampleUpdateView, self).get_form_kwargs()
        kwargs.update({"request": self.request})  # must pass self.request into form
        return kwargs

License

django-fineuploader is released under the BSD license.

Release files for django-fineuploader 0.2.1

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-fineuploader 0.2.1
File Size Uploaded
django-fineuploader-0.2.1.tar.gz 102.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-fineuploader 0.2.1
File Interpreter ABI Platform
django_fineuploader-0.2.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 210.0 kB

Release files / django-fineuploader-0.2.1.tar.gz

Download URL django-fineuploader-0.2.1.tar.gz
Size 102.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ffe41d34517c4a9cff8f1ba6dcc86db5af2d755f4ae4c6daa51010e29df0a655
BLAKE2b-256 checksum
How to use checksums
875f589ba7c50c7ffae32c293c98565c762f37729731981735680be1e3864ff3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.8

Release files / django_fineuploader-0.2.1-py2.py3-none-any.whl

Download URL django_fineuploader-0.2.1-py2.py3-none-any.whl
Size 108.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a64a0cc3499ce84cd6ba55a55b8f3529fe7d5631c7ec2ff72c99b3d976312df5
BLAKE2b-256 checksum
How to use checksums
81d8de28a428e7fb75fa96b40c691563583f7b901557b77f481efa5cd04da3ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.8

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

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