diff options
| author | Tom Christie | 2012-11-16 14:48:42 -0800 |
|---|---|---|
| committer | Tom Christie | 2012-11-16 14:48:42 -0800 |
| commit | e40000c834b7476fe684720bf54abda7ca1c4c06 (patch) | |
| tree | 4a2cdc2796c4e088cc1e3ddd5f31ded1d3682a32 /docs | |
| parent | 31f01bd6315f46bf28bb4c9c25a5298785fc4fc6 (diff) | |
| parent | f801e5d3050591403de04fde7d18522fabc8fe49 (diff) | |
| download | django-rest-framework-e40000c834b7476fe684720bf54abda7ca1c4c06.tar.bz2 | |
Merge pull request #408 from markotibold/file_and_image_fields
Added a FileField and an ImageField
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api-guide/fields.md | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/docs/api-guide/fields.md b/docs/api-guide/fields.md index 0485b158..7f42dc5e 100644 --- a/docs/api-guide/fields.md +++ b/docs/api-guide/fields.md @@ -165,6 +165,33 @@ A floating point representation. Corresponds to `django.db.models.fields.FloatField`. +## FileField + +A file representation. Performs Django's standard FileField validation. + +Corresponds to `django.forms.fields.FileField`. + +**Signature:** `FileField(max_length=None, allow_empty_file=False)` + + - `max_length` designates the maximum length for the file name. + + - `allow_empty_file` designates if empty files are allowed. + +## ImageField + +An image representation. + +Corresponds to `django.forms.fields.ImageField`. + +Requires the `PIL` package. + +Signature and validation is the same as with `FileField`. + +--- + +**Note:** `FileFields` and `ImageFields` are only suitable for use with MultiPartParser, since eg json doesn't support file uploads. +Django's regular [FILE_UPLOAD_HANDLERS] are used for handling uploaded files. + --- # Relational Fields @@ -286,3 +313,4 @@ This field is always read-only. * `slug_url_kwarg` - The named url parameter for the slug field lookup. Default is to use the same value as given for `slug_field`. [cite]: http://www.python.org/dev/peps/pep-0020/ +[FILE_UPLOAD_HANDLERS]: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-FILE_UPLOAD_HANDLERS |
