Commit Graph

8338 Commits

Author SHA1 Message Date
Pawel
95f0b0867a
Documentation: improve the action decorator documentation (#7316) (#7380)
* Documentation: improve the action decorator documentation (#7316)
2020-10-13 08:32:38 +02:00
Aarni Koskela
0bdd537cc4
Ignore derivations of BrowsableAPIRenderer in OpenAPI schema (#7497)
* Ignore derivations of BrowsableAPIRenderer in OpenAPI schema
* Improve test_renderer_mapping test

Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
2020-10-12 16:40:26 +02:00
Thomas Leese
eff97efa28
Don't catch exceptions in get_queryset (#7480)
In the `to_internal_value` method of the primary key and slug related fields, `TypeError`s and `ValueError`s are caught from `self.get_queryset().get(...)` and presented to the user. This works fine for most cases, but can cause problems if the exception is coming from `self.get_queryset()` rather than from the `.get(...)`.

It means errors in the `get_queryset` method can be hidden and presented back to the user as though, for example, the input provided to the `to_internal_value` was the wrong type, whereas in reality there's a bug in the `get_queryset` method and therefore it should bubble up and be exposed as a server error.

I've decided to fix this because twice now I've had to debug why I'm seeing `invalid_type` errors from my serializer (errors like `wrong pk type - int` when the `pk` type on my model is `int`) when the real problem was a bug in my custom `get_queryset` method.
2020-10-10 18:02:21 +01:00
Adam Johnson
fd5e1a745a
Fixed some documentation headings to use a space (#7364) 2020-10-10 17:42:59 +01:00
zach valenta
ffde169102
Add docs link to to_internal_value() (#7476) 2020-10-10 17:36:15 +01:00
Thomas Riccardi
1ef192811c
Add missing quoting for data keyword argument in serializer doc (#7587) 2020-10-10 17:34:39 +01:00
Adam Johnson
563b043768
Error on deprecation and pending deprecation warnings (#7586)
Erroring on deprecation or pending deprecation warnings means they are caught early. This will avoid the cycle of releasing with 'support for Django X', then chasing all the deprecation warnings one-by-one. Instead, when a new Django version is added to the test matrix, it will fail until all the relevant warnings are fixed. This avoids passing these warnings on to users, some of whom don't upgrade until they are all fixed.
2020-10-10 17:34:00 +01:00
David Smith
79c37d0dc3
Return NotImplemented sooner for ErrorDetail equality test (#7531)
The test suite raises warnings when tested against Python 3.9
`DeprecationWarning: NotImplemented should not be used in a boolean context`

Where `r` returns `NotImplemented` then this change returns `NotImplemented` first to avoid the comparison test.
2020-10-09 12:21:22 +01:00
Kryštof Pilnáček
79daf315c4
Fix: authtoken.TokenProxy cannot be proxy when not installed (#7571)
closes https://github.com/encode/django-rest-framework/issues/7442
2020-10-09 12:16:15 +01:00
Adam Johnson
931b34e7de
Remove tox-venv from Travis setup (#7585)
This was added in #6139. However it seems [tox-venv is no longer maintained](https://github.com/tox-dev/tox-venv), the related [virtualenv issue has been closed](https://github.com/pypa/virtualenv/issues/355), and I suspect with the virtualenv rewrite fixed the problem with site.py and the warnings referred to for the DRF tests.
2020-10-09 11:09:34 +01:00
Adam Johnson
7921e9af43
Fix RemovedInDjango40Warning for middleware get_resopnse() (#7513)
Fixes #7417.

Fixes all these issues seen with `tox -e py38-django31`:

```
  /Users/chainz/Documents/Projects/django-rest-framework/tests/test_request.py:208: RemovedInDjango40Warning: Passing None for the middleware get_response argument is deprecated.
    SessionMiddleware().process_request(self.wrapped_request)

tests/test_requests_client.py: 1 test with warning
tests/test_testing.py: 4 tests with warnings
tests/test_throttling.py: 1 test with warning
tests/authentication/test_authentication.py: 4 tests with warnings
tests/browsable_api/test_browsable_api.py: 4 tests with warnings
  /Users/chainz/Documents/Projects/django-rest-framework/rest_framework/authentication.py:139: RemovedInDjango40Warning: Passing None for the middleware get_response argument is deprecated.
    check = CSRFCheck()
```
2020-10-09 10:48:03 +01:00
Mopsan
5e23b559f8
Fix example override of SchemaGenerator.get_schema() 2020-10-09 09:38:11 +01:00
Xavier Ordoquy
2e721cdbc8
Merge pull request #7436 from markstory/patch-1
Fix broken links in documenting API section
2020-10-06 22:26:22 +02:00
Xavier Ordoquy
ebc1ebf0c4
Merge pull request #7481 from smithdc1/app-config
default_app_config application variable is deprecated in Django 3.2
2020-10-06 22:16:29 +02:00
Xavier Ordoquy
fdf277a782
Merge pull request #6843 from max-wittig/patch-1
docs(tutorial): add missing permission import in viewsets
2020-10-06 21:42:30 +02:00
स्पर्श
6a45a6a36f
Fix broken machinalis links (#7580)
#7572 #7423 #7573  all are related to this
2020-10-06 13:14:11 +01:00
Xavier Ordoquy
d635bc9c71
Merge pull request #7539 from verhovsky/patch-2
Correct indentation
2020-10-06 13:04:08 +02:00
Xavier Ordoquy
9dc10d2af7
Merge pull request #7577 from Exifers/patch-1
Documentation: use retrieve instead of read for Viewset
2020-10-05 21:54:33 +02:00
Xavier Ordoquy
a849627f88 Fixes #7538 - use retrieve action name instead of detail 2020-10-05 21:48:07 +02:00
Emmanuel Meric de Bellefon
86ec3da2da
Update 6-viewsets-and-routers.md 2020-10-05 20:56:42 +02:00
Adam Johnson
91916a4db1
Fix NullBooleanField warning (#7565)
The argument to Field is 'allow_null'.
2020-09-30 13:47:06 +01:00
Tom Christie
be87eb43b3 Update release notes with 3.11.1, 3.11.2 2020-09-30 09:44:31 +01:00
Tom Christie
a03c85225f
Update test_templatetags.py 2020-09-30 09:10:36 +01:00
Xavier Ordoquy
c7ba30825a
Merge pull request #7559 from AliMirlou/patch-1
Fix typo in release notes
2020-09-29 10:48:51 +02:00
Ali Mirlou
9edd5dfe5d
Fix typo in release notes 2020-09-28 23:15:30 +03:30
Tom Christie
05b3865838 Version 3.12.1 2020-09-28 16:18:23 +01:00
Hugo Rodger-Brown
995188f8c5
Add missing TokenProxy migration (#7557)
Fixes #7554
2020-09-28 16:16:18 +01:00
Tom Christie
68b23075a2
Add date to 3.12 release. 2020-09-28 10:54:52 +01:00
Tom Christie
6f7aad8ffa
Placeholder for 3.12 release (#7379)
* Placeholder for 3.12 release

* Updating release notes

* Updating release notes

* Updating release notes

* Update release notes

* Fix typo

* Basic structure for release announcement

* 3.12 release notes

* Version 3.12.0
2020-09-28 10:47:50 +01:00
Esieboma Jeremiah
9ee67bbff7
corrects typographical error in line 118 (#7553) 2020-09-28 08:52:17 +01:00
Tom Christie
ae649336b1
Drop urlize_quoted_links (#7548) 2020-09-23 15:39:06 +01:00
T. Franzel
c6e24521da
Add third-party schema library drf-spectacular to docs (#7540)
Co-authored-by: T. Franzel <13507857+tfranzel@users.noreply.github.com>
2020-09-21 11:39:35 +01:00
Борис Верховский
98761e4ebb
Correct indentation 2020-09-16 09:43:27 -04:00
johnthagen
e17779c47b
Make it more clear to add django_filters to INSTALLED_APPS in docs. (#7535) 2020-09-14 19:46:51 +02:00
Mohammad Amin Haghpanah
04f39c42ee
Add drf-psq package to docs (#7451)
* Add drf-psq to third party packages

* Add drf-psq to permissions.md

this package is an extension that gives support for having action-based **permission_classes**, **serializer_class**, and **queryset** dependent on permission-based rules.

Co-authored-by: Salar Nasiri <salarnasiri@users.noreply.github.com>
2020-09-09 08:54:05 +01:00
Rafael Henter
327cbef299
Add Django API Client to the third party packages (#7440) 2020-09-08 15:44:03 +01:00
Francisco Couzo
6b632c15b1
Remove unnecessary type conversions (#7526) 2020-09-08 15:42:01 +01:00
Michael K
ddcd8b539b
Run tests against Python 3.9 (#7517)
3.9.0 final is expected on Monday, 2020-10-05
See https://www.python.org/dev/peps/pep-0596/#schedule

Also mention Django 3.1 compat where missing.
2020-09-08 15:40:21 +01:00
Adam Johnson
410575dace
Replace all url() calls with path() or re_path() (#7512)
* url() is deprecated in Django 3.1

* update given feedbacks on url() is deprecated in Django 3.1

* Fix test_urlpatterns.py to continue testing mixed re_path() and path()

* Fix one missed reference

Co-authored-by: sanjusci <sanju.sci9@gmail.com>
2020-09-08 15:32:27 +01:00
David Smith
9990b59281
Dropped test compatibility shims for Django <2.2. (#7523) 2020-09-07 20:00:17 +02:00
David Smith
d5461e93fe
Bump flake8 to 3.8.3 (#7521) 2020-09-05 10:02:27 +02:00
David Smith
b8ab30683a default_app_config application variable is deprecated in Django 3.2 2020-09-03 21:57:41 +01:00
Charles
35c0abf24e
Change Token.generate_key to a Classmethod (#7502)
* adds classmethod decorator to generate_key and test to confirm change is acceptable

* self -> cls
2020-09-03 11:51:03 +01:00
Ryan P Kilby
f323049ecc
Fix pk-only optimization for properties (#7142)
* Add callable/prop tests for pk-only optimization

* Fix related field pk-only optimization for props
2020-09-03 11:49:15 +01:00
Bob Thomas
b3e02592d0
Add support for Django 3.1 JSONField (#7467)
Django 3.1 adds a new generic JSONField to replace the PostgreSQL-specific one. This adds support for the new field type, which should behave the same as the existing PostgreSQL field.

Django's new JSONField also includes support for a custom "decoder", so add support for that in the serializer field.
2020-09-03 11:47:11 +01:00
johnthagen
7f3a3557a0
Add drf_ujson2 reference (#7494) 2020-08-25 15:15:17 -07:00
Vlad
e215db206a
Updated url()'s with path() and re_path() (#7492) 2020-08-25 13:50:02 +02:00
Justin Duke
48c327c681
Fix schema typo (#7491) 2020-08-24 03:44:34 -07:00
Борис Верховский
374c0d4142
Punctuation fix (#7488)
* Punctuation fix

* more punctuation
2020-08-20 13:23:59 +01:00
David Smith
355afcf64b
isort v5 (#7484) 2020-08-17 13:26:56 -07:00