Commit Graph

8850 Commits

Author SHA1 Message Date
Aristotelis Mikropoulos
67ebdd32cd
Reject PrimaryKeyRelatedField bool lookup values (#7597)
* Reject PrimaryKeyRelatedField bool lookup values

* Test PrimaryKeyRelatedField bool lookup rejection

* Fix indentation in test
2021-03-17 13:28:38 +00:00
Tom Christie
7b53960c3b
Revert "made Browsable API base template cachable: omit CSRF token when unnecessary (#7717)" (#7847)
This reverts commit 9c9ffb18f4.
2021-03-17 13:24:55 +00:00
Tom Christie
3e274146fc
Fix WSGI signature for DjangoTestAdapter (#7846)
Closes https://github.com/encode/django-rest-framework/issues/7132
2021-03-17 13:24:38 +00:00
Yuekui
a40bce50cd
No need to explictitly set None as default (#7373) 2021-03-16 13:29:13 +00:00
Jesse London
9c9ffb18f4
made Browsable API base template cachable: omit CSRF token when unnecessary (#7717)
HTML responses generated by the Browsable API otherwise generate
inconsistent ETAGs -- due to the presence of CSRF tokens in the response
-- even when the API is read-only, (and as such when the response
contains no resource-modifying forms, i.e. neither POST nor PUT forms,
which might require the CSRF token).

While the template was appropriately including CSRF tokens only within
POST and PUT forms, its AJAX overlay included the CSRF token in *every*
response, regardless of whether it would be needed.

This change brings the logic of the `script` block into line with that
of the rest of the template -- and such that read-only APIs (and really
the Browsable API pages of *any* read-only resources) will not
needlessly include the CSRF token, and will now be safely cachable -- by
both back-end systems and by the user agent.
2021-03-16 13:25:21 +00:00
Jeff Baumes
b0ca248d88
Correct the use of "to" (#7696) 2021-03-16 12:57:04 +00:00
Ömer Faruk Abacı
ce1568322a
Ordering filter bug with model property serializer field (#7609)
* Add failing tests for ordering filter with model property

* Fix get_default_valid_fields of OrderingFilter

* Filter model properties in get_default_valid_fields of OrderingFilter
2021-03-16 12:53:39 +00:00
Alex Hedlund
b256c46cb1
Render JSON fields with proper indentation in browsable API forms. (#6243)
* Fix JSONBoundField usage on nested serializers (#6211)

* Unify JSONBoundField as_form_field output between py2 and py3

When using json.dumps with indenting, in python2 the default formatting
prints whitespace after commas (,) and python3 does not. This can be
unified with the separators keyword argument.
2021-03-15 10:44:03 +00:00
Henryk Plötz
ff625ecff5
Document object level permissions gotchas (#7446)
* Document the limitation that object level permissions do not apply to object creation. See for example #6409.

* Add overview of three different ways to restrict access
2021-03-15 10:28:45 +00:00
Ömer Faruk Abacı
883f6fe814
Rename django-extra-fields to drf-extra-fields (#7833) 2021-03-11 11:39:06 +00:00
Carlton Gibson
f070619061
Updated tox/travis to point to Django main branch. (#7827) 2021-03-11 10:26:11 +00:00
Tom Christie
39a98c80a6 Fix 'get_page_number' implementation 2021-03-11 09:21:22 +00:00
Tom Christie
c05cbe2da2
Update pagination.py
Include `last_page_strings` logic *inside* the `get_page_number method.
2021-03-10 12:50:59 +00:00
Max Morlocke
ffe11d41bd
upgrade pytest+pytest-django to eliminate dependencies on six (#7672)
* upgrade to latest version of pytest+pytest-django to eliminate dependency on six

* rollback pytest to 6.1 as py35 is dropped in 6.2

Co-authored-by: Tom Christie <tom@tomchristie.com>
2021-03-10 12:45:47 +00:00
Feanil Patel
c78f992176
Make the doc on overriding the default permission classes more clear. (#7661) 2021-03-10 12:44:17 +00:00
Eshaan Bansal
4f3cd8c7b0
add django-rest-durin to 3rd party auth libs [docs] (#7615)
Co-authored-by: Tom Christie <tom@tomchristie.com>
2021-03-10 12:40:45 +00:00
John Alexis Munera
cef74d1726
Add rest-framework-actions to Third Party Packages (#7688)
This pull request adds rest-framework-actions to Third Party Packages, under Views

rest-framework-actions can be found on PyPi here: https://pypi.org/project/rest-framework-actions/

Co-authored-by: Tom Christie <tom@tomchristie.com>
2021-03-10 12:37:06 +00:00
sarath ak
6f6d402d04
Allow 'get_page' method for overriding #7626 (#7652) 2021-03-10 12:32:10 +00:00
Pierre Chiquet
c603b98403
Fix OpenAPISchema rendering for timedelta (#7641)
* Add failing test when rendering to json a schema with timedelta

* Fix JSONOpenAPIRenderer for fields with default=timedelta()

* fix isort

* fix test for python 3.5

Co-authored-by: Pierre Chiquet <pierre.chiquet@ubikey.fr>
2021-03-10 12:03:15 +00:00
PaulGilmartin
c69e2e4eaa
Add graphwrap to third-party-packages.md (#7819)
* Add graphwrap to third-party-packages documentation

* Fix typo in third party packages docs

* Remove additional newline

Co-authored-by: Paul Gilmartin <paulgilmartin@Pauls-MacBook-Pro.local>
Co-authored-by: Tom Christie <tom@tomchristie.com>
2021-03-10 09:02:38 +00:00
Dmitry Mugtasimov
a3ae8ea77e
Do not do SELECT count(*) FROM ... if pagination is not requested (#6098)
* Do not do `SELECT count(*) FROM ...` if pagination is not requested

* Update pagination.py

Co-authored-by: Tom Christie <tom@tomchristie.com>
2021-03-09 12:06:12 +00:00
Romain Rigaux
750bad0a58
Actually use the loginUser arguments in the example (#7714) 2021-03-09 12:00:51 +00:00
Vitor Hugo
4e0d6c4118
Update default.css (#7643)
When I apply a theme to the bootstrap used in the project, boolean inputs are out of line with the rest of the form. With this small payment, this no longer occurs.
2021-03-09 11:54:58 +00:00
Celia Oakley
747fef6134
Add django-rest-authemail to Third Party Packages (#7679)
* Add django-rest-authemail to Authentication

* Add django-rest-authemail to Third Party Packages
2021-03-09 11:51:52 +00:00
Chris Guo
82b8a64a02
docs: add example for caching (#7118) 2021-03-09 11:49:19 +00:00
Berkant
95ae92ef23
Fix #7706 (#7724)
Handle non-dict values for NestedSerializer during BrowsableAPI
rendering.
2021-03-09 11:34:18 +00:00
David Kerkeslager
05512160ab
Respect allow_null=True on DecimalFields (#7718)
* Handle None in to_representation()
* Return None as '' in to_representation() when coerce_to_string=True
* Handle '' as None in to_internal_value(), for symmetry with
  to_representation(), and because the empty concept doesn't make sense
  for Decimal.
2021-03-09 10:49:03 +00:00
Nathan Glover
a89a6427d3
#7703 adding deprecations to release notes (#7716)
* #7703 adding deprecations to release notes

* #7703 - update link for gh6687
2021-03-09 10:22:37 +00:00
Cas Ebbers
393f867995
Overlooked translation in search.html (#7551) 2021-03-09 10:21:11 +00:00
kuter
e9a54e38e1
add support for Yes/No literals with BooleanField (#7701) 2021-03-09 10:17:30 +00:00
Igor Polyakov
b463878132
Commas added in README (#7730)
To make it more comfortable for users to copy and paste snippets
2021-03-09 10:16:19 +00:00
Alex Cotsarelis
e32ebc4199
Docs: DjangoModelPermissions works on views with get_queryset() method. (#7693)
Sentinel querysets not needed after v3.1.2
2021-03-08 12:09:17 +00:00
Jean-Pierre Merx
234527959d
Have options example in documenting-your-api.md to return a Response (#7639)
It was returning data which is not correct. Closes #7638.

Co-authored-by: Jean-Pierre Merx <jean-pierre.merx@aictivate.com>
2021-03-08 12:08:26 +00:00
arcanemachine
ef112f5017
Provide example for dict in ValidationError detail (#7788)
Added a sentence describing the use of a dictionary as the `detail` argument of a ValidationError, and how it can be used to add field-level errors during object-level validation.
2021-03-08 11:46:35 +00:00
Tom Christie
ec29ff8a80
Delete ISSUE_TEMPLATE.md 2021-03-03 15:45:40 +00:00
Tom Christie
ee51145574
Update config.yml 2021-03-03 15:43:57 +00:00
Tom Christie
37b8d2018d
Create 1-issue.md 2021-03-03 15:42:38 +00:00
Tom Christie
db0bb5ef42
Update config.yml 2021-03-03 15:39:22 +00:00
Tom Christie
c9a00bdb2c
Update config.yml 2021-03-03 15:33:14 +00:00
Tom Christie
344235ab37
Create config.yml 2021-03-03 15:32:19 +00:00
Tom Christie
1deb8ae370
Update FUNDING.yml 2021-03-03 15:06:42 +00:00
Jonathan Mortensen
de7468d0b4
support multi db atomic_requests (#7739) 2021-03-03 11:15:39 +00:00
Usoof Mansoor
8f6d2d2f9c
Update docs link to Django OAuth Toolkit. (#7737) 2021-03-02 08:26:31 +01:00
Asif Saif Uddin
1ec0f86b58
Dj32 (#7713)
adds django 3.2 line to the build matrix
2021-02-16 13:17:29 +01:00
Tonye Jack
3e956df6eb Fixed test 2021-02-16 11:28:38 +01:00
Sebastian Jordan
19655edbf7
Handle tuples same as lists in ValidationError detail context (#7647) 2021-01-06 13:13:34 +00:00
Adrian Coveney
3db8877889 Clarify documentation for TemplateHTMLRenderer
Clarify that the response from a view may need to be modified to provide TemplateHTMLRenderer with a dict for it to use.
2020-12-30 09:11:38 +01:00
Tom Christie
8351747d98
Update index.md 2020-12-21 16:41:12 +00:00
Erwin Junge
bb133522ef Small documentation fix 2020-11-22 12:21:30 +01:00
babaroga
3ab8d4706e changed unicode to str 2020-11-21 18:25:55 +01:00