You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,4 +2,6 @@
2
2
3
3
At this point in its lifespan we consider Django REST framework to be essentially feature-complete. We may accept pull requests that track the continued development of Django versions, but would prefer not to accept new features or code formatting changes.
4
4
5
+
Apart from minor documentation changes, the [GitHub discussions page](https://github.com/encode/django-rest-framework/discussions) should generally be your starting point. Please only open a pull request if you've been recommended to do so **after discussion**.
6
+
5
7
The [Contributing guide in the documentation](https://www.django-rest-framework.org/community/contributing/) gives some more information on our process and code of conduct.
Copy file name to clipboardExpand all lines: docs/api-guide/fields.md
+7-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ Set to false if this field is not required to be present during deserialization.
42
42
43
43
Setting this to `False` also allows the object attribute or dictionary key to be omitted from output when serializing the instance. If the key is not present it will simply not be included in the output representation.
44
44
45
-
Defaults to `True`. If you're using [Model Serializer](https://www.django-rest-framework.org/api-guide/serializers/#modelserializer)default value will be `False`if you have specified `blank=True` or `default`or `null=True` at your field in your `Model`.
45
+
Defaults to `True`. If you're using [Model Serializer](https://www.django-rest-framework.org/api-guide/serializers/#modelserializer), the default value will be `False`when you have specified a `default`, or when the corresponding `Model` field has `blank=True`or `null=True`and is not part of a unique constraint at the same time. (Note that without a `default` value, [unique constraints will cause the field to be required](https://www.django-rest-framework.org/api-guide/validators/#optional-fields).)
46
46
47
47
### `default`
48
48
@@ -377,13 +377,16 @@ A Duration representation.
377
377
Corresponds to `django.db.models.fields.DurationField`
378
378
379
379
The `validated_data` for these fields will contain a `datetime.timedelta` instance.
380
-
The representation is a string following this format `'[DD] [HH:[MM:]]ss[.uuuuuu]'`.
*`format` - A string representing the output format. If not specified, this defaults to the same value as the `DURATION_FORMAT` settings key, which will be `'django'` unless set. Formats are described below. Setting this value to `None` indicates that Python `timedelta` objects should be returned by `to_representation`. In this case the date encoding will be determined by the renderer.
384
384
*`max_value` Validate that the duration provided is no greater than this value.
385
385
*`min_value` Validate that the duration provided is no less than this value.
386
386
387
+
#### `DurationField` formats
388
+
Format may either be the special string `'iso-8601'`, which indicates that [ISO 8601][iso8601] style intervals should be used (eg `'P4DT1H15M20S'`), or `'django'` which indicates that Django interval format `'[DD] [HH:[MM:]]ss[.uuuuuu]'` should be used (eg: `'4 1:15:20'`).
389
+
387
390
---
388
391
389
392
# Choice selection fields
@@ -857,4 +860,4 @@ The [django-rest-framework-hstore][django-rest-framework-hstore] package provide
0 commit comments