Skip to content

Commit 2770f5e

Browse files
committed
Merge branch 'master' into migrate_setuppy_to_pryoject.toml
2 parents c4bcfc4 + 77ef27f commit 2770f5e

25 files changed

+293
-179
lines changed

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Keep GitHub Actions up to date with GitHub's Dependabot...
2+
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
3+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
4+
version: 2
5+
updates:
6+
- package-ecosystem: github-actions
7+
directory: /
8+
groups:
9+
github-actions:
10+
patterns:
11+
- "*" # Group all Action updates into a single larger pull request
12+
schedule:
13+
interval: weekly

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@v4
2727

28-
- uses: actions/setup-python@v4
28+
- uses: actions/setup-python@v5
2929
with:
3030
python-version: ${{ matrix.python-version }}
3131
cache: 'pip'
@@ -62,9 +62,9 @@ jobs:
6262
name: Test documentation links
6363
runs-on: ubuntu-22.04
6464
steps:
65-
- uses: actions/checkout@v3
65+
- uses: actions/checkout@v4
6666

67-
- uses: actions/setup-python@v4
67+
- uses: actions/setup-python@v5
6868
with:
6969
python-version: '3.9'
7070

.github/workflows/pre-commit.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,12 @@ jobs:
1111
runs-on: ubuntu-latest
1212

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

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

22-
- uses: pre-commit/action@v3.0.0
23-
with:
24-
token: ${{ secrets.GITHUB_TOKEN }}
22+
- uses: pre-commit/action@v3.0.1

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,9 @@ repos:
2525
exclude: ^(?!docs).*$
2626
additional_dependencies:
2727
- black==23.1.0
28+
- repo: https://github.com/codespell-project/codespell
29+
# Configuration for codespell is in .codespellrc
30+
rev: v2.2.6
31+
hooks:
32+
- id: codespell
33+
exclude: locale|kickstarter-announcement.md|coreapi-0.1.1.js

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ There is a live example API for testing purposes, [available here][sandbox].
5656
# Requirements
5757

5858
* Python 3.6+
59-
* Django 4.2, 4.1, 4.0, 3.2, 3.1, 3.0
59+
* Django 5.0, 4.2, 4.1, 4.0, 3.2, 3.1, 3.0
6060

6161
We **highly recommend** and only officially support the latest patch release of
6262
each Python and Django series.

docs/api-guide/schemas.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ The following sections explain more.
5656

5757
### Install dependencies
5858

59-
pip install pyyaml uritemplate
59+
pip install pyyaml uritemplate inflection
6060

6161
* `pyyaml` is used to generate schema into YAML-based OpenAPI format.
6262
* `uritemplate` is used internally to get parameters in path.
63+
* `inflection` is used to pluralize operations more appropriately in the list endpoints.
6364

6465
### Generating a static schema with the `generateschema` management command
6566

docs/community/3.15-announcement.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<style>
2+
.promo li a {
3+
float: left;
4+
width: 130px;
5+
height: 20px;
6+
text-align: center;
7+
margin: 10px 30px;
8+
padding: 150px 0 0 0;
9+
background-position: 0 50%;
10+
background-size: 130px auto;
11+
background-repeat: no-repeat;
12+
font-size: 120%;
13+
color: black;
14+
}
15+
.promo li {
16+
list-style: none;
17+
}
18+
</style>
19+
20+
# Django REST framework 3.15
21+
22+
At the Internet, on March 15th, 2024, with 176 commits by 138 authors, we are happy to announce the release of Django REST framework 3.15.
23+
24+
## Django 5.0 and Python 3.12 support
25+
26+
The latest release now fully supports Django 5.0 and Python 3.12.
27+
28+
The current minimum versions of Django still is 3.0 and Python 3.6.
29+
30+
## Primary Support of UniqueConstraint
31+
32+
`ModelSerializer` generates validators for [UniqueConstraint](https://docs.djangoproject.com/en/4.0/ref/models/constraints/#uniqueconstraint) (both UniqueValidator and UniqueTogetherValidator)
33+
34+
## ValidationErrors improvements
35+
36+
The `ValidationError` has been aligned with Django's, currently supporting the same style (signature) and nesting.
37+
38+
## SimpleRouter non-regex matching support
39+
40+
By default the URLs created by `SimpleRouter` use regular expressions. This behavior can be modified by setting the `use_regex_path` argument to `False` when instantiating the router.
41+
42+
## ZoneInfo as the primary source of timezone data
43+
44+
Dependency on pytz has been removed and deprecation warnings have been added, Django will provide ZoneInfo instances as long as USE_DEPRECATED_PYTZ is not enabled. More info on the migration can be found [in this guide](https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html).
45+
46+
## Align `SearchFilter` behaviour to `django.contrib.admin` search
47+
48+
Searches now may contain _quoted phrases_ with spaces, each phrase is considered as a single search term, and it will raise a validation error if any null-character is provided in search. See the [Filtering API guide](../api-guide/filtering.md) for more information.
49+
50+
## Default values propagation
51+
52+
Model fields' default values are now propagated to serializer fields, for more information see the [Serializer fields API guide](../api-guide/fields.md#default).
53+
54+
## Other fixes and improvements
55+
56+
There are a number of fixes and minor improvements in this release, ranging from documentation, internal infrastructure (typing, testing, requirements, deprecation, etc.), security and overall behaviour.
57+
58+
See the [release notes](release-notes.md) page for a complete listing.

docs/community/release-notes.md

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,90 @@ You can determine your currently installed version using `pip show`:
3434

3535
---
3636

37+
## 3.15.x series
38+
39+
### 3.15.0
40+
41+
Date: 15th March 2024
42+
43+
* Django 5.0 and Python 3.12 support [[#9157](https://github.com/encode/django-rest-framework/pull/9157)]
44+
* Use POST method instead of GET to perform logout in browsable API [[9208](https://github.com/encode/django-rest-framework/pull/9208)]
45+
* Added jQuery 3.7.1 support & dropped previous version [[#9094](https://github.com/encode/django-rest-framework/pull/9094)]
46+
* Use str as default path converter [[#9066](https://github.com/encode/django-rest-framework/pull/9066)]
47+
* Document support for http.HTTPMethod in the @action decorator added in Python 3.11 [[#9067](https://github.com/encode/django-rest-framework/pull/9067)]
48+
* Update exceptions.md [[#9071](https://github.com/encode/django-rest-framework/pull/9071)]
49+
* Partial serializer should not have required fields [[#7563](https://github.com/encode/django-rest-framework/pull/7563)]
50+
* Propagate 'default' from model field to serializer field. [[#9030](https://github.com/encode/django-rest-framework/pull/9030)]
51+
* Allow to override child.run_validation call in ListSerializer [[#8035](https://github.com/encode/django-rest-framework/pull/8035)]
52+
* Align SearchFilter behaviour to django.contrib.admin search [[#9017](https://github.com/encode/django-rest-framework/pull/9017)]
53+
* Class name added to unknown field error [[#9019](https://github.com/encode/django-rest-framework/pull/9019)]
54+
* Fix: Pagination response schemas. [[#9049](https://github.com/encode/django-rest-framework/pull/9049)]
55+
* Fix choices in ChoiceField to support IntEnum [[#8955](https://github.com/encode/django-rest-framework/pull/8955)]
56+
* Fix `SearchFilter` rendering search field with invalid value [[#9023](https://github.com/encode/django-rest-framework/pull/9023)]
57+
* Fix OpenAPI Schema yaml rendering for `timedelta` [[#9007](https://github.com/encode/django-rest-framework/pull/9007)]
58+
* Fix `NamespaceVersioning` ignoring `DEFAULT_VERSION` on non-None namespaces [[#7278](https://github.com/encode/django-rest-framework/pull/7278)]
59+
* Added Deprecation Warnings for CoreAPI [[#7519](https://github.com/encode/django-rest-framework/pull/7519)]
60+
* Removed usage of `field.choices` that triggered full table load [[#8950](https://github.com/encode/django-rest-framework/pull/8950)]
61+
* Permit mixed casing of string values for `BooleanField` validation [[#8970](https://github.com/encode/django-rest-framework/pull/8970)]
62+
* Fixes `BrowsableAPIRenderer` for usage with `ListSerializer`. [[#7530](https://github.com/encode/django-rest-framework/pull/7530)]
63+
* Change semantic of `OR` of two permission classes [[#7522](https://github.com/encode/django-rest-framework/pull/7522)]
64+
* Remove dependency on `pytz` [[#8984](https://github.com/encode/django-rest-framework/pull/8984)]
65+
* Make set_value a method within `Serializer` [[#8001](https://github.com/encode/django-rest-framework/pull/8001)]
66+
* Fix URLPathVersioning reverse fallback [[#7247](https://github.com/encode/django-rest-framework/pull/7247)]
67+
* Warn about Decimal type in min_value and max_value arguments of DecimalField [[#8972](https://github.com/encode/django-rest-framework/pull/8972)]
68+
* Fix mapping for choice values [[#8968](https://github.com/encode/django-rest-framework/pull/8968)]
69+
* Refactor read function to use context manager for file handling [[#8967](https://github.com/encode/django-rest-framework/pull/8967)]
70+
* Fix: fallback on CursorPagination ordering if unset on the view [[#8954](https://github.com/encode/django-rest-framework/pull/8954)]
71+
* Replaced `OrderedDict` with `dict` [[#8964](https://github.com/encode/django-rest-framework/pull/8964)]
72+
* Refactor get_field_info method to include max_digits and decimal_places attributes in SimpleMetadata class [[#8943](https://github.com/encode/django-rest-framework/pull/8943)]
73+
* Implement `__eq__` for validators [[#8925](https://github.com/encode/django-rest-framework/pull/8925)]
74+
* Ensure CursorPagination respects nulls in the ordering field [[#8912](https://github.com/encode/django-rest-framework/pull/8912)]
75+
* Use ZoneInfo as primary source of timezone data [[#8924](https://github.com/encode/django-rest-framework/pull/8924)]
76+
* Add username search field for TokenAdmin (#8927) [[#8934](https://github.com/encode/django-rest-framework/pull/8934)]
77+
* Handle Nested Relation in SlugRelatedField when many=False [[#8922](https://github.com/encode/django-rest-framework/pull/8922)]
78+
* Bump version of jQuery to 3.6.4 & updated ref links [[#8909](https://github.com/encode/django-rest-framework/pull/8909)]
79+
* Support UniqueConstraint [[#7438](https://github.com/encode/django-rest-framework/pull/7438)]
80+
* Allow Request, Response, Field, and GenericAPIView to be subscriptable. This allows the classes to be made generic for type checking. [[#8825](https://github.com/encode/django-rest-framework/pull/8825)]
81+
* Feat: Add some changes to ValidationError to support django style validation errors [[#8863](https://github.com/encode/django-rest-framework/pull/8863)]
82+
* Fix Respect `can_read_model` permission in DjangoModelPermissions [[#8009](https://github.com/encode/django-rest-framework/pull/8009)]
83+
* Add SimplePathRouter [[#6789](https://github.com/encode/django-rest-framework/pull/6789)]
84+
* Re-prefetch related objects after updating [[#8043](https://github.com/encode/django-rest-framework/pull/8043)]
85+
* Fix FilePathField required argument [[#8805](https://github.com/encode/django-rest-framework/pull/8805)]
86+
* Raise ImproperlyConfigured exception if `basename` is not unique [[#8438](https://github.com/encode/django-rest-framework/pull/8438)]
87+
* Use PrimaryKeyRelatedField pkfield in openapi [[#8315](https://github.com/encode/django-rest-framework/pull/8315)]
88+
* replace partition with split in BasicAuthentication [[#8790](https://github.com/encode/django-rest-framework/pull/8790)]
89+
* Fix BooleanField's allow_null behavior [[#8614](https://github.com/encode/django-rest-framework/pull/8614)]
90+
* Handle Django's ValidationErrors in ListField [[#6423](https://github.com/encode/django-rest-framework/pull/6423)]
91+
* Remove a bit of inline CSS. Add CSP nonce where it might be required and is available [[#8783](https://github.com/encode/django-rest-framework/pull/8783)]
92+
* Use autocomplete widget for user selection in Token admin [[#8534](https://github.com/encode/django-rest-framework/pull/8534)]
93+
* Make browsable API compatible with strong CSP [[#8784](https://github.com/encode/django-rest-framework/pull/8784)]
94+
* Avoid inline script execution for injecting CSRF token [[#7016](https://github.com/encode/django-rest-framework/pull/7016)]
95+
* Mitigate global dependency on inflection [[#8017](https://github.com/encode/django-rest-framework/pull/8017)] [[#8781](https://github.com/encode/django-rest-framework/pull/8781)]
96+
* Register Django urls [[#8778](https://github.com/encode/django-rest-framework/pull/8778)]
97+
* Implemented Verbose Name Translation for TokenProxy [[#8713](https://github.com/encode/django-rest-framework/pull/8713)]
98+
* Properly handle OverflowError in DurationField deserialization [[#8042](https://github.com/encode/django-rest-framework/pull/8042)]
99+
* Fix OpenAPI operation name plural appropriately [[#8017](https://github.com/encode/django-rest-framework/pull/8017)]
100+
* Represent SafeString as plain string on schema rendering [[#8429](https://github.com/encode/django-rest-framework/pull/8429)]
101+
* Fix #8771 - Checking for authentication even if `_ignore_model_permissions = True` [[#8772](https://github.com/encode/django-rest-framework/pull/8772)]
102+
* Fix 404 when page query parameter is empty string [[#8578](https://github.com/encode/django-rest-framework/pull/8578)]
103+
* Fixes instance check in ListSerializer.to_representation [[#8726](https://github.com/encode/django-rest-framework/pull/8726)] [[#8727](https://github.com/encode/django-rest-framework/pull/8727)]
104+
* FloatField will crash if the input is a number that is too big [[#8725](https://github.com/encode/django-rest-framework/pull/8725)]
105+
* Add missing DurationField to SimpleMetada label_lookup [[#8702](https://github.com/encode/django-rest-framework/pull/8702)]
106+
* Add support for Python 3.11 [[#8752](https://github.com/encode/django-rest-framework/pull/8752)]
107+
* Make request consistently available in pagination classes [[#8764](https://github.com/encode/django-rest-framework/pull/9764)]
108+
* Possibility to remove trailing zeros on DecimalFields representation [[#6514](https://github.com/encode/django-rest-framework/pull/6514)]
109+
* Add a method for getting serializer field name (OpenAPI) [[#7493](https://github.com/encode/django-rest-framework/pull/7493)]
110+
* Add `__eq__` method for `OperandHolder` class [[#8710](https://github.com/encode/django-rest-framework/pull/8710)]
111+
* Avoid importing `django.test` package when not testing [[#8699](https://github.com/encode/django-rest-framework/pull/8699)]
112+
* Preserve exception messages for wrapped Django exceptions [[#8051](https://github.com/encode/django-rest-framework/pull/8051)]
113+
* Include `examples` and `format` to OpenAPI schema of CursorPagination [[#8687](https://github.com/encode/django-rest-framework/pull/8687)] [[#8686](https://github.com/encode/django-rest-framework/pull/8686)]
114+
* Fix infinite recursion with deepcopy on Request [[#8684](https://github.com/encode/django-rest-framework/pull/8684)]
115+
* Refactor: Replace try/except with contextlib.suppress() [[#8676](https://github.com/encode/django-rest-framework/pull/8676)]
116+
* Minor fix to SerializeMethodField docstring [[#8629](https://github.com/encode/django-rest-framework/pull/8629)]
117+
* Minor refactor: Unnecessary use of list() function [[#8672](https://github.com/encode/django-rest-framework/pull/8672)]
118+
* Unnecessary list comprehension [[#8670](https://github.com/encode/django-rest-framework/pull/8670)]
119+
* Use correct class to indicate present deprecation [[#8665](https://github.com/encode/django-rest-framework/pull/8665)]
120+
37121
## 3.14.x series
38122

39123
### 3.14.0
@@ -946,7 +1030,7 @@ See the [release announcement][3.6-release].
9461030
* description.py codes and tests removal. ([#4153][gh4153])
9471031
* Wrap guardian.VERSION in tuple. ([#4149][gh4149])
9481032
* Refine validator for fields with <source=> kwargs. ([#4146][gh4146])
949-
* Fix None values representation in childs of ListField, DictField. ([#4118][gh4118])
1033+
* Fix None values representation in children of ListField, DictField. ([#4118][gh4118])
9501034
* Resolve TimeField representation for midnight value. ([#4107][gh4107])
9511035
* Set proper status code in AdminRenderer for the redirection after POST/DELETE requests. ([#4106][gh4106])
9521036
* TimeField render returns None instead of 00:00:00. ([#4105][gh4105])

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ continued development by **[signing up for a paid plan][funding]**.
8787
REST framework requires the following:
8888

8989
* Python (3.6, 3.7, 3.8, 3.9, 3.10, 3.11)
90-
* Django (3.0, 3.1, 3.2, 4.0, 4.1, 4.2)
90+
* Django (3.0, 3.1, 3.2, 4.0, 4.1, 4.2, 5.0)
9191

9292
We **highly recommend** and only officially support the latest patch release of
9393
each Python and Django series.

docs/tutorial/quickstart.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ Okay, now let's wire up the API URLs. On to `tutorial/urls.py`...
132132
path('', include(router.urls)),
133133
path('api-auth/', include('rest_framework.urls', namespace='rest_framework'))
134134
]
135-
136-
urlpatterns += router.urls
137135

138136
Because we're using viewsets instead of views, we can automatically generate the URL conf for our API, by simply registering the viewsets with a router class.
139137

0 commit comments

Comments
 (0)