diff options
| author | Tom Christie | 2013-03-05 20:57:35 +0000 | 
|---|---|---|
| committer | Tom Christie | 2013-03-05 20:57:35 +0000 | 
| commit | 4f7b028a0a983b79ebca63b2ba48ce97e7a06175 (patch) | |
| tree | 85be479d5680399f7b5a27cddbb13c67b10ac6cf | |
| parent | c20ebe95f6707d63373d9c583e90bcbc6e021899 (diff) | |
| download | django-rest-framework-4f7b028a0a983b79ebca63b2ba48ce97e7a06175.tar.bz2 | |
Updating docs
| -rw-r--r-- | docs/api-guide/fields.md | 45 | ||||
| -rw-r--r-- | docs/api-guide/settings.md | 36 | 
2 files changed, 47 insertions, 34 deletions
| diff --git a/docs/api-guide/fields.md b/docs/api-guide/fields.md index c1f3c051..68e619a0 100644 --- a/docs/api-guide/fields.md +++ b/docs/api-guide/fields.md @@ -181,26 +181,10 @@ Corresponds to `django.forms.fields.RegexField`  **Signature:** `RegexField(regex, max_length=None, min_length=None)` -## DateField - -A date representation. - -Optionally takes `format` as parameter to replace the matching pattern. - -Corresponds to `django.db.models.fields.DateField` - -**Signature:** `DateField(input_formats=None, output_format=False)` - - - `input_formats` designates which input formats are supported. This will override the `DATE_INPUT_FORMATS` - - - `output_format` designates which output format will be used. This will override the `DATE_OUTPUT_FORMAT` -  ## DateTimeField  A date and time representation. -Optionally takes `format` as parameter to replace the matching pattern. -  Corresponds to `django.db.models.fields.DateTimeField`  When using `ModelSerializer` or `HyperlinkedModelSerializer`, note that any model fields with `auto_now=True` or `auto_now_add=True` will use serializer fields that are `read_only=True` by default. @@ -213,11 +197,25 @@ If you want to override this behavior, you'll need to declare the `DateTimeField          class Meta:              model = Comment -**Signature:** `DateTimeField(input_formats=None, output_format=False)` +**Signature:** `DateTimeField(format=None, input_formats=None)` + +* `format` - A string representing the output format.  If not specified, the `DATETIME_FORMAT` setting will be used, which defaults to `'iso8601'`. +* `input_formats` - A list of strings representing the input formats which may be used to parse the date. If not specified, the `DATETIME_INPUT_FORMATS` setting will be used, which defaults to `['iso8601']`. + +DateTime format strings may either be [python strftime formats][strftime] which explicitly specifiy the format, or the special string `'is8601'`, which indicates that [ISO 8601][iso8601] style datetimes should be used. (eg `'2013-01-29T12:34:56.000000'`) + +## DateField + +A date representation. + +Corresponds to `django.db.models.fields.DateField` + +**Signature:** `DateField(format=None, input_formats=None)` - - `input_formats` designates which input formats are supported. This will override the `DATETIME_INPUT_FORMATS` +* `format` - A string representing the output format.  If not specified, the `DATE_FORMAT` setting will be used, which defaults to `'iso8601'`. +* `input_formats` - A list of strings representing the input formats which may be used to parse the date. If not specified, the `DATE_INPUT_FORMATS` setting will be used, which defaults to `['iso8601']`.  - - `output_format` designates which output format will be used. This will override the `DATETIME_OUTPUT_FORMAT` +Date format strings may either be [python strftime formats][strftime] which explicitly specifiy the format, or the special string `'is8601'`, which indicates that [ISO 8601][iso8601] style dates should be used. (eg `'2013-01-29'`)  ## TimeField @@ -227,11 +225,12 @@ Optionally takes `format` as parameter to replace the matching pattern.  Corresponds to `django.db.models.fields.TimeField` -**Signature:** `TimeField(input_formats=None, output_format=False)` +**Signature:** `TimeField(format=None, input_formats=None)` - - `input_formats` designates which input formats are supported. This will override the `TIME_INPUT_FORMATS` +* `format` - A string representing the output format.  If not specified, the `TIME_FORMAT` setting will be used, which defaults to `'iso8601'`. +* `input_formats` - A list of strings representing the input formats which may be used to parse the date. If not specified, the `TIME_INPUT_FORMATS` setting will be used, which defaults to `['iso8601']`. - - `output_format` designates which output format will be used. This will override the `TIME_OUTPUT_FORMAT` +Time format strings may either be [python strftime formats][strftime] which explicitly specifiy the format, or the special string `'is8601'`, which indicates that [ISO 8601][iso8601] style times should be used. (eg `'12:34:56.000000'`)  ## IntegerField @@ -276,3 +275,5 @@ Django's regular [FILE_UPLOAD_HANDLERS] are used for handling uploaded files.  [cite]: https://docs.djangoproject.com/en/dev/ref/forms/api/#django.forms.Form.cleaned_data  [FILE_UPLOAD_HANDLERS]: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-FILE_UPLOAD_HANDLERS +[strftime]: http://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior +[iso8601]: http://www.w3.org/TR/NOTE-datetime diff --git a/docs/api-guide/settings.md b/docs/api-guide/settings.md index 04569f44..82730225 100644 --- a/docs/api-guide/settings.md +++ b/docs/api-guide/settings.md @@ -174,28 +174,40 @@ The name of a parameter in the URL conf that may be used to provide a format suf  Default: `'format'` -## DATE_INPUT_FORMATS - -Default: `ISO8601` +## DATETIME_FORMAT -## DATE_OUTPUT_FORMAT +A format string that should be used by default for `DateTimeField` serializer fields. -Default: `ISO8601` +Default: `'iso8601'`  ## DATETIME_INPUT_FORMATS -Default: `ISO8601` +A list of format strings that should be used by default for parsing inputs to `DateTimeField` serializer fields. -## DATETIME_OUTPUT_FORMAT +Default: `['iso8601']` -Default: `ISO8601` +## DATE_FORMAT -## TIME_INPUT_FORMATS +A format string that should be used by default for `DateField` serializer fields. + +Default: `'iso8601'` + +## DATE_INPUT_FORMATS -Default: `ISO8601` +A list of format strings that should be used by default for parsing inputs to `DateField` serializer fields. + +Default: `['iso8601']` + +## TIME_FORMAT + +A format string that should be used by default for `TimeField` serializer fields. + +Default: `'iso8601'` + +## TIME_INPUT_FORMATS -## TIME_OUTPUT_FORMAT +A list of format strings that should be used by default for parsing inputs to `TimeField` serializer fields. -Default: `ISO8601` +Default: `['iso8601']`  [cite]: http://www.python.org/dev/peps/pep-0020/ | 
