diff options
| author | Robert Romano | 2012-11-18 21:07:44 -0800 |
|---|---|---|
| committer | Robert Romano | 2012-11-18 21:07:44 -0800 |
| commit | f5f1ac49ec9d9cb180a00c791f2701c3f5a2d65b (patch) | |
| tree | 663e254f3125d1281035d471fc4fa38d7ca3ee3d /docs/api-guide/fields.md | |
| parent | d541e0c42326443b613df764cbe26a68b852b71d (diff) | |
| parent | d1472740bc5f08871343d1a63e409e34d05504cb (diff) | |
| download | django-rest-framework-f5f1ac49ec9d9cb180a00c791f2701c3f5a2d65b.tar.bz2 | |
Update robromano fork with upstream master
Conflicts:
docs/topics/credits.md
docs/topics/release-notes.md
Diffstat (limited to 'docs/api-guide/fields.md')
| -rw-r--r-- | docs/api-guide/fields.md | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/docs/api-guide/fields.md b/docs/api-guide/fields.md index 0485b158..d1c31ecc 100644 --- a/docs/api-guide/fields.md +++ b/docs/api-guide/fields.md @@ -131,6 +131,18 @@ or `django.db.models.fields.TextField`. **Signature:** `CharField(max_length=None, min_length=None)` +## URLField + +Corresponds to `django.db.models.fields.URLField`. Uses Django's `django.core.validators.URLValidator` for validation. + +**Signature:** `CharField(max_length=200, min_length=None)` + +## SlugField + +Corresponds to `django.db.models.fields.SlugField`. + +**Signature:** `CharField(max_length=50, min_length=None)` + ## ChoiceField A field that can accept a value out of a limited set of choices. @@ -165,6 +177,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 +325,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 |
