GithubHelp home page GithubHelp logo

steckelfisch / django-plupload Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hevela/django-plupload

0.0 1.0 0.0 320 KB

A barebones plupload app for django

License: GNU General Public License v2.0

Python 40.96% HTML 1.39% CSS 10.96% JavaScript 46.69%

django-plupload's Introduction

django-plupload

django-plupload is a barebones multi file upload app for django. Uses plupload [http://www.plupload.com/], and jQuery. You can use it in your applications with simple inclusion tag.

Requirements:

  • Nothing really, if you plan to upload images, then you'll need PIL, but just for files, you don't need anything
  • Well, you'll need django (at least 1.4v) installed and running

Usage: In the html template just load the 'plupload_script' tag passing the csrf token to generate the javascript needed, along with the url where you are going to process the file uploads. and include the 'pl_upload_form' to generate the 'div' where the upload queue will appear:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    {% load plupload %}
    {% plupload_script csrf_token "/plupload/" %}
</head>
<body>
    <form method="post" action=".">
    {% csrf_token %}
    {% pl_upload_form %}
        <p>
            <button type="submit">Save</button>
        </p>
    </form>
</body>
</html>

Installation

1.Install an app. Do it by adding:

'plupload', 

string to your settings.py -> INSTALLED_APPS = () dictionary.

2.Register urls in your root urlconf urls.py adding string to your urlpatterns like so :

#The url where the upload form is located:
url(r'^$', 'plupload.views.upload'),

3.In plupload/views.py, change the FILE_FOLDER var to whatever dir you want to use:

FILE_FOLDER = "templates/static/media/csv_files/"

Note that 'FILE_FOLDER' is relative to your 'PROJECT_PATH', wich is added in settings.py

4.Edit templates and styles to meet your needs. (Optional) (for e.g. changing the form design and/or behavior)

Models

It's barebones, so it doesn't need any model, so you can easily modify the plupload.py views functions to meet your needs :)

That's all, I'm open for sugestions, or bug corrections if you find one.

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.