-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
53 additions
and
41 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
include LICENSE.txt | ||
include LICENSE | ||
recursive-exclude * *.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
Django Multiupload | ||
================== | ||
|
||
Dead simple drop-in multi file upload field for django forms using HTML5's ``multiple`` attribute. | ||
|
||
Installation | ||
------------ | ||
|
||
* Install the package using pip (or easy_install if you really have to) | ||
|
||
:: | ||
|
||
$ pip install django-multiupload | ||
|
||
|
||
* or directly from this repository the get the development version (if you're feeling adventurous) | ||
|
||
:: | ||
|
||
$ pip install -e git+https://github.com/Chive/django-multiupload.git#egg=multiupload | ||
|
||
|
||
Usage | ||
----- | ||
|
||
* Add the form field to your form and make sure to save the uploaded files in the form's ``save`` method | ||
|
||
|
||
:: | ||
|
||
from multiupload.fields import MultiFileField | ||
|
||
|
||
class MyUploadForm(forms.Form): | ||
attachments = MultiFileField(max_num=3, min_num=1, max_file_size=1024*1024*5) | ||
... | ||
|
||
def save(self, commit=True): | ||
super(MyUploadForm, self).save(commit=commit) | ||
|
||
for each in self.cleaned_data['attachments']: | ||
att = Attachment(parent=self.instance, file=each) | ||
att.save() | ||
|
||
return self.instance | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters