Skip to content

Commit e553e3a

Browse files
committed
Add documentation
1 parent 8c517cd commit e553e3a

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

README.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,26 @@ django-validated-file
44
This Django app adds two field types, ValidatedFileField and ValidatedImageField, that add the
55
capability of checking the document size and types the user may send.
66

7+
Installation
8+
------------
9+
10+
* Download and install package with python setup.py install.
11+
* Note that this package depends on python-magic (to check field types).
12+
* Add 'validatedfile' to your INSTALLED_APPS in settings.py.
13+
14+
Usage
15+
-----
16+
17+
Create a model and add a field of type ValidatedFileField. You can add a maximum size in bytes
18+
and a list of valid mime types that will be allowed. The list of all mime types is available
19+
here: http://www.iana.org/assignments/media-types/index.html. If a user tries to upload a file
20+
with too much size or without a valid type, a form validation error will occur::
21+
22+
class TestModel(models.Model):
23+
the_file = ValidatedFileField(
24+
null = True,
25+
blank = True,
26+
upload_to = 'testfile',
27+
max_upload_size = 10240,
28+
content_types = ['image/png'])
29+

0 commit comments

Comments
 (0)