Coder Social home page Coder Social logo

django-filepicker's Introduction

django-filepicker

A django plugin to make integrating with Filepicker.io even easier

##Installation pip install django-filepicker

##Demo To see how all the pieces come together, see the example code in demo/, which you can run with the standard python manage.py runserver command

###models.py import django_filepicker class TestModel(models.Model): #FPFileField is a field that will render as a filepicker dragdrop widget, but #When accessed will provide a File-like interface (so you can do fpfile.read(), for instance) fpfile = django_filepicker.models.FPFileField(upload_to='uploads')

###views.py #building the form - automagically turns the uploaded fpurl into a File object form = models.TestModelForm(request.POST, request.FILES) if form.is_valid(): #Save will read the data and upload it to the location defined in TestModel form.save()

Be sure to also provide your Filepicker.io api key, either as a parameter to the FPFileField or in settings.py as FILEPICKER_API_KEY

##Components ###Models The filepicker django library defines the FPFileField model field so you can get all the benefits of using Filepicker.io as a drop-in replacement for the standard django FileField. No need to change any of your view logic.

###Forms Similarly with the FPFileField for models, the filepicker django library defines a FPFileField for forms as well, that likewise serves as a drop-in replacement for the standard django FileField. There is also the FPUrlField if you want to store the Filepicker.io URL instead

###Middleware Also included is a middleware library that will take any Filepicker.io urls passed to the server, download the contents, and place the result in request.FILES. This way, you can keep your backend code for handling file uploads the same as before while adding all the front-end magic that Filepicker.io provides

If you have any questions, don't hesitate to reach out at [email protected]. For more information, see https://filepicker.io

Open-sourced under the MIT License. Pull requests encouraged!

django-filepicker's People

Contributors

brettcvz avatar sethwoodworth avatar smartt avatar asilachev avatar jonathan3 avatar nickpresta avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.