Skip to content

Commit e45c2d6

Browse files
committed
Use ImageField, update README with requirements section
1 parent 8281b33 commit e45c2d6

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

README.md

+14-3
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,23 @@ Features
1919
* No flash (or other browser plugins) needed
2020
* … more at the [upstream's features page](http://aquantum-demo.appspot.com/file-upload#features)
2121

22+
Requirements
23+
============
24+
25+
* Django
26+
* Python Imaging Library
27+
28+
If you do not get PIL to work (_pillow_ is a replacement package that works
29+
with virtulalenvs), use FileField instead of ImageField in
30+
fileupload/models.py as commented in the file.
31+
2232
Installation
2333
============
2434

25-
* run ./manage.py syncdb
26-
* go to localhost:8000/upload/new/
27-
* upload some files
35+
* pip install -r requirements.txt (will install django and pillow)
36+
* python manage.py syncdb
37+
* python manage.py runserver
38+
* go to localhost:8000/upload/new/ and upload some files
2839

2940
License
3041
=======

fileupload/models.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
class Picture(models.Model):
44

5-
# This is a small demo using FileField instead of ImageField, not
6-
# depending on PIL. You will probably want ImageField in your app.
7-
file = models.FileField(upload_to="pictures")
5+
# This is a small demo using just two fields. The slug field is really not
6+
# necessary, but makes the code simpler. ImageField depends on PIL or
7+
# pillow (where Pillow is easily installable in a virtualenv. If you have
8+
# problems installing pillow, use a more generic FileField instead.
9+
10+
#file = models.FileField(upload_to="pictures")
11+
file = models.ImageField(upload_to="pictures")
812
slug = models.SlugField(max_length=50, blank=True)
913

1014
def __unicode__(self):

requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
django
2+
pillow

0 commit comments

Comments
 (0)