Skip to content

Commit 5836ccc

Browse files
authored
Merge branch 'encode:main' into master
2 parents 7c014a3 + f0ba887 commit 5836ccc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1414
-390
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Discussions
4+
url: https://github.com/encode/django-rest-framework/discussions
5+
about: >
6+
The "Discussions" forum is where you want to start. 💖
7+
Please note that at this point in its lifespan, we consider Django REST framework to be feature-complete.

.github/workflows/main.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CI
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
pull_request:
88

99
jobs:
@@ -21,9 +21,9 @@ jobs:
2121
- '3.13'
2222

2323
steps:
24-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@v5
2525

26-
- uses: actions/setup-python@v5
26+
- uses: actions/setup-python@v6
2727
with:
2828
python-version: ${{ matrix.python-version }}
2929
cache: 'pip'
@@ -52,9 +52,9 @@ jobs:
5252
name: Test documentation links
5353
runs-on: ubuntu-24.04
5454
steps:
55-
- uses: actions/checkout@v4
55+
- uses: actions/checkout@v5
5656

57-
- uses: actions/setup-python@v5
57+
- uses: actions/setup-python@v6
5858
with:
5959
python-version: '3.9'
6060

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: mkdocs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- docs/**
9+
- docs_theme/**
10+
- requirements/requirements-documentation.txt
11+
- mkdocs.yml
12+
- .github/workflows/mkdocs-deploy.yml
13+
14+
jobs:
15+
deploy:
16+
runs-on: ubuntu-latest
17+
environment: github-pages
18+
permissions:
19+
contents: write
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
steps:
23+
- uses: actions/checkout@v5
24+
- run: git fetch --no-tags --prune --depth=1 origin gh-pages
25+
- uses: actions/setup-python@v6
26+
with:
27+
python-version: 3.x
28+
- run: pip install -r requirements/requirements-documentation.txt
29+
- run: mkdocs gh-deploy

.github/workflows/pre-commit.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ name: pre-commit
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
pull_request:
88

99
jobs:
1010
pre-commit:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v5
1515
with:
1616
fetch-depth: 0
1717

18-
- uses: actions/setup-python@v5
18+
- uses: actions/setup-python@v6
1919
with:
2020
python-version: "3.10"
2121

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,17 @@ repos:
3131
hooks:
3232
- id: codespell
3333
exclude: locale|kickstarter-announcement.md|coreapi-0.1.1.js
34+
additional_dependencies:
35+
# python doesn't come with a toml parser prior to 3.11
36+
- "tomli; python_version < '3.11'"
3437

3538
- repo: https://github.com/asottile/pyupgrade
3639
rev: v3.19.1
3740
hooks:
3841
- id: pyupgrade
3942
args: ["--py39-plus", "--keep-percent-format"]
43+
44+
- repo: https://github.com/tox-dev/pyproject-fmt
45+
rev: v2.6.0
46+
hooks:
47+
- id: pyproject-fmt

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22

33
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.
44

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+
57
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.

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -179,25 +179,25 @@ Please see the [security policy][security-policy].
179179

180180
[build-status-image]: https://github.com/encode/django-rest-framework/actions/workflows/main.yml/badge.svg
181181
[build-status]: https://github.com/encode/django-rest-framework/actions/workflows/main.yml
182-
[coverage-status-image]: https://img.shields.io/codecov/c/github/encode/django-rest-framework/master.svg
183-
[codecov]: https://codecov.io/github/encode/django-rest-framework?branch=master
182+
[coverage-status-image]: https://img.shields.io/codecov/c/github/encode/django-rest-framework/main.svg
183+
[codecov]: https://codecov.io/github/encode/django-rest-framework?branch=main
184184
[pypi-version]: https://img.shields.io/pypi/v/djangorestframework.svg
185185
[pypi]: https://pypi.org/project/djangorestframework/
186186
[group]: https://groups.google.com/forum/?fromgroups#!forum/django-rest-framework
187187

188188
[funding]: https://fund.django-rest-framework.org/topics/funding/
189189
[sponsors]: https://fund.django-rest-framework.org/topics/funding/#our-sponsors
190190

191-
[sentry-img]: https://raw.githubusercontent.com/encode/django-rest-framework/master/docs/img/premium/sentry-readme.png
192-
[stream-img]: https://raw.githubusercontent.com/encode/django-rest-framework/master/docs/img/premium/stream-readme.png
193-
[spacinov-img]: https://raw.githubusercontent.com/encode/django-rest-framework/master/docs/img/premium/spacinov-readme.png
194-
[retool-img]: https://raw.githubusercontent.com/encode/django-rest-framework/master/docs/img/premium/retool-readme.png
195-
[bitio-img]: https://raw.githubusercontent.com/encode/django-rest-framework/master/docs/img/premium/bitio-readme.png
196-
[posthog-img]: https://raw.githubusercontent.com/encode/django-rest-framework/master/docs/img/premium/posthog-readme.png
197-
[cryptapi-img]: https://raw.githubusercontent.com/encode/django-rest-framework/master/docs/img/premium/cryptapi-readme.png
198-
[fezto-img]: https://raw.githubusercontent.com/encode/django-rest-framework/master/docs/img/premium/fezto-readme.png
199-
[svix-img]: https://raw.githubusercontent.com/encode/django-rest-framework/master/docs/img/premium/svix-premium.png
200-
[zuplo-img]: https://raw.githubusercontent.com/encode/django-rest-framework/master/docs/img/premium/zuplo-readme.png
191+
[sentry-img]: https://raw.githubusercontent.com/encode/django-rest-framework/main/docs/img/premium/sentry-readme.png
192+
[stream-img]: https://raw.githubusercontent.com/encode/django-rest-framework/main/docs/img/premium/stream-readme.png
193+
[spacinov-img]: https://raw.githubusercontent.com/encode/django-rest-framework/main/docs/img/premium/spacinov-readme.png
194+
[retool-img]: https://raw.githubusercontent.com/encode/django-rest-framework/main/docs/img/premium/retool-readme.png
195+
[bitio-img]: https://raw.githubusercontent.com/encode/django-rest-framework/main/docs/img/premium/bitio-readme.png
196+
[posthog-img]: https://raw.githubusercontent.com/encode/django-rest-framework/main/docs/img/premium/posthog-readme.png
197+
[cryptapi-img]: https://raw.githubusercontent.com/encode/django-rest-framework/main/docs/img/premium/cryptapi-readme.png
198+
[fezto-img]: https://raw.githubusercontent.com/encode/django-rest-framework/main/docs/img/premium/fezto-readme.png
199+
[svix-img]: https://raw.githubusercontent.com/encode/django-rest-framework/main/docs/img/premium/svix-premium.png
200+
[zuplo-img]: https://raw.githubusercontent.com/encode/django-rest-framework/main/docs/img/premium/zuplo-readme.png
201201

202202
[sentry-url]: https://getsentry.com/welcome/
203203
[stream-url]: https://getstream.io/?utm_source=DjangoRESTFramework&utm_medium=Webpage_Logo_Ad&utm_content=Developer&utm_campaign=DjangoRESTFramework_Jan2022_HomePage

docs/api-guide/caching.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def get_user_list(request):
8585
**NOTE:** The [`cache_page`][page] decorator only caches the
8686
`GET` and `HEAD` responses with status 200.
8787

88-
[page]: https://docs.djangoproject.com/en/dev/topics/cache/#the-per-view-cache
89-
[cookie]: https://docs.djangoproject.com/en/dev/topics/http/decorators/#django.views.decorators.vary.vary_on_cookie
90-
[headers]: https://docs.djangoproject.com/en/dev/topics/http/decorators/#django.views.decorators.vary.vary_on_headers
91-
[decorator]: https://docs.djangoproject.com/en/dev/topics/class-based-views/intro/#decorating-the-class
88+
[page]: https://docs.djangoproject.com/en/stable/topics/cache/#the-per-view-cache
89+
[cookie]: https://docs.djangoproject.com/en/stable/topics/http/decorators/#django.views.decorators.vary.vary_on_cookie
90+
[headers]: https://docs.djangoproject.com/en/stable/topics/http/decorators/#django.views.decorators.vary.vary_on_headers
91+
[decorator]: https://docs.djangoproject.com/en/stable/topics/class-based-views/intro/#decorating-the-class

docs/api-guide/exceptions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,5 +269,5 @@ The [drf-standardized-errors][drf-standardized-errors] package provides an excep
269269

270270
[cite]: https://doughellmann.com/blog/2009/06/19/python-exception-handling-techniques/
271271
[authentication]: authentication.md
272-
[django-custom-error-views]: https://docs.djangoproject.com/en/dev/topics/http/views/#customizing-error-views
272+
[django-custom-error-views]: https://docs.djangoproject.com/en/stable/topics/http/views/#customizing-error-views
273273
[drf-standardized-errors]: https://github.com/ghazi-git/drf-standardized-errors

docs/api-guide/fields.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Set to false if this field is not required to be present during deserialization.
4242

4343
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.
4444

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).)
4646

4747
### `default`
4848

@@ -377,13 +377,16 @@ A Duration representation.
377377
Corresponds to `django.db.models.fields.DurationField`
378378

379379
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]'`.
381380

382-
**Signature:** `DurationField(max_value=None, min_value=None)`
381+
**Signature:** `DurationField(format=api_settings.DURATION_FORMAT, max_value=None, min_value=None)`
383382

383+
* `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.
384384
* `max_value` Validate that the duration provided is no greater than this value.
385385
* `min_value` Validate that the duration provided is no less than this value.
386386

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+
387390
---
388391

389392
# Choice selection fields
@@ -857,4 +860,4 @@ The [django-rest-framework-hstore][django-rest-framework-hstore] package provide
857860
[django-hstore]: https://github.com/djangonauts/django-hstore
858861
[python-decimal-rounding-modes]: https://docs.python.org/3/library/decimal.html#rounding-modes
859862
[django-current-timezone]: https://docs.djangoproject.com/en/stable/topics/i18n/timezones/#default-time-zone-and-current-time-zone
860-
[django-docs-select-related]: https://docs.djangoproject.com/en/3.1/ref/models/querysets/#django.db.models.query.QuerySet.select_related
863+
[django-docs-select-related]: https://docs.djangoproject.com/en/stable/ref/models/querysets/#django.db.models.query.QuerySet.select_related

0 commit comments

Comments
 (0)