Commit Graph

1046 Commits

Author SHA1 Message Date
Jonathan Mortensen
de7468d0b4
support multi db atomic_requests (#7739) 2021-03-03 11:15:39 +00:00
Sebastian Jordan
19655edbf7
Handle tuples same as lists in ValidationError detail context (#7647) 2021-01-06 13:13:34 +00:00
David Smith
04e0c2b9ab
Bumped Markdown version to 3.3 (#7590) 2020-10-13 17:27:08 +01: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
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
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
Tom Christie
a03c85225f
Update test_templatetags.py 2020-09-30 09:10:36 +01:00
Tom Christie
ae649336b1
Drop urlize_quoted_links (#7548) 2020-09-23 15:39:06 +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
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
Ryan P Kilby
1e383f103a
Check extra action func.__name__ (#7098) 2020-08-05 21:29:47 -07:00
Mariusz Felisiak
4b06e0a5a1
Fix tests crash on SQLite without JSON1 extension. (#7409) 2020-07-12 11:08:40 +02:00
Anton Agestam
76232437d4
Allow type checkers to make serializers generic (#7385) 2020-07-07 10:05:36 +01:00
Dhaval Mehta
5ce237e004
Corrected regex serialization for OpenAPI. (#7389)
* replace \Z by \z in regex

* fix test cases for Django >= 3.0

* fix isort

* Added comment for why `\z`.

Co-authored-by: Carlton Gibson <carlton@noumenal.es>
2020-06-28 14:28:59 +02:00
Jair Henrique
bb795674f8
Drop all compat support to Django < 2 urls (#7337) 2020-05-14 20:31:38 +02:00
Jair Henrique
65add6679d
Remove unnecessary test skips (#7336) 2020-05-14 14:49:04 +01:00
Jair Henrique
b83e9121f3
Remove compat urls for Django < 2.0 (#7335) 2020-05-14 14:48:14 +01:00
Jair Henrique
aed74961ba
Remove compat for ProhibitNullCharactersValidator (#7333) 2020-05-14 08:24:09 +01:00
Kevin Brown
e888fc11c7
Merge NullBooleanField with BooleanField(allow_null=True) (#7122)
* Make `NullBooleanField` subclass `BooleanField`

This removes a lot of the redundancy that was in place becuase we
were not doing this. This maintains the `None` initial value that
was previously present, as well as disallowing `allow_null` to be
passed in.

* Remove special case for mapping `NullBooleanField`

In newer versions of Django, the `NullBooleanField` is handled the
same way as a `BooleanField(null=True)`. Given that we also support
that combination, and that our own `NullBooleanField` behaves in the
same manner, it makes sense to remove the special casing that exists
for it.

* Add test for BooleanField(null=True, choices)

* Remove special case for NullBooleanField

* Adjust mapping tests for NullBooleanField

* Fixed linting error

* Raise deprecation warning when NullBooleanField is used

* Fix linting issue in imports
2020-05-13 14:59:04 +01:00
Ryan P Kilby
089162e6e3
Fix ModelSerializer unique_together handling for field sources (#7143)
* Fix ModelSerializer unique_together field sources

Updates ModelSerializer to check for serializer fields that map to the
model field sources in the unique_together lists.

* Ensure field name ordering consistency
2020-05-13 11:11:26 +01:00
Ryan P Kilby
8a38991d6a
Fix SearchFilter.must_call_distinict for annotation+m2m (#7146)
* Test SearchFilter annotation+m2m distinct

* Fix SearchFilter annotation+m2m distinct
2020-05-11 10:55:39 +01:00
Mathieu Pillard
d7777ea10f
Pass custom code to PermissionDenied if permission class had one set (#7306) 2020-05-01 10:22:36 +01:00
Ryan P Kilby
900773ad06
Minor test improvements (#7297)
* Pass data via response instead of renderer_context

Instead of relying on internal implementation details to get a reference
to the response or view, attach these directly to the returned response.

* Remove unused method
2020-04-29 11:21:42 +01:00
Rick van Hattem
5828d8f7ca
Changed hardcoded /tmp/ directory to autodetect from system (#7292) 2020-04-29 11:20:02 +01:00
Ryan P Kilby
e275b9036a
Allow context to be provided to get_serializer (#7298)
* Test generics serializer behavior

* Allow context to be provided to get_serializer
2020-04-29 11:19:44 +01:00
Dhaval Mehta
e1336387d1
Added example for pagination in schemas. (#7275) 2020-04-24 16:13:13 +02:00
Matthaus Woolard
812f254bbd
SearchFilter to support JSONField and HStoreField (#7121)
* SearchFilter to support Custom query Transforms

Since Some fields support `__` as a custom Transform for query lookups we needed to update the m2m checking code to handle search_fields that contain __ that are not relationships.

* Update documentation on SearchFilter to include references to JSON and HStore Fields.
2020-04-23 09:38:14 +01:00
Carlton Gibson
b2497fc245 Convert openapi.AutoSchema methods to public API. 2020-04-09 20:05:16 +02:00
Carlton Gibson
b1bfff4f1c Revert "Schemas: Improved decimal handling when mapping ChoiceField. (#7264)"
This reverts commit 1872bde462.
2020-04-09 19:35:46 +02:00
Dhaval Mehta
1872bde462
Schemas: Improved decimal handling when mapping ChoiceField. (#7264) 2020-04-09 19:18:00 +02:00
Clinton Blackburn
603aac7db1
Corrected OpenAPI schema type for DecimalField (#7254) 2020-04-09 19:16:17 +02:00
Dhaval Mehta
41f27c3b43
Schemas: Don't generate component for DELETE method. (#7229) 2020-04-09 19:10:50 +02:00
Ryan P Kilby
dd33ebb4e2
Add Request repr (#7239) 2020-03-29 12:01:14 +01:00
Ryan P Kilby
908f91d8ef
Set action for HEAD requests (#7223)
* Test viewset action attr

* Add 'head' to viewset actions map
2020-03-09 09:43:02 +00:00
Tom Christie
4a98533746
Fix - run test_head_request_against_viewset method (#7219) 2020-03-05 13:18:48 +00:00
Tom Christie
73f7bf4941
Extra action detection is too permissive. Add failing test + fix (#7217)
* Add failing test

* Add failing test++

* Make get_extra_action less permissive
2020-03-05 10:18:22 +00:00
Martin Desrumaux
6a23fa0649
OpenAPI: Make operationId camelCase, matching spec examples. (#7208) 2020-03-03 17:51:51 +01:00
Martin Desrumaux
609f708a27
Fix schema generation for ObtainAuthToken view. (#7211) 2020-03-03 13:27:34 +01:00
Martin Desrumaux
8aa8be7653
Implement OpenAPI Components (#7124) 2020-03-02 19:35:27 +01:00
Martin Desrumaux
797518af6d
OpenAPI: Warn user about duplicate operationIds. (#7207) 2020-03-02 16:44:06 +01:00
Martin Desrumaux
5b16a17242
OpenAPI: Allow customizing operation name. (#7190) 2020-03-02 16:40:18 +01:00
Mateusz Legięcki
94a09149b6
OpenAPI: Use 201 status code for POST requests. (#7206) 2020-03-02 16:32:26 +01:00
Dhaval Mehta
2a5c2f3f70
Added OpenAPI tags to schemas. (#7184) 2020-02-28 12:06:03 +01:00
Kevin Kennell
d7b218f5eb
decode base64 credentials as utf8; adjust tests (#7193)
* decode base64 credentials as utf8; adjust tests

* basicauth: add dedicated test for utf8 credentials

* basicauth: add fallback to latin-1 encoding if utf-8 fails
2020-02-17 16:10:52 +00:00
Thorsten
f81ca78642
Add file option to generateschema (#7130) 2020-02-12 20:35:54 +01:00
Thorsten
4137ef41ef
Disable yaml aliases for schema generation. (#7131) 2020-02-03 14:41:47 +01:00